我的index.php文件位于:
myserverHost / API /公共/
包括api调用,如获取令牌。像:
myserverHost / API /公共/令牌
仅当我键入确切的URL时才有效。即
myserverHost / API /公共/令牌
我正在尝试编写重写规则,我可以使用:
myserverHost / API /令牌
这里我在.htaccess文件内容中尝试过:
RewriteEngine On
#RewriteBase /api/
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
# Make sure $HTTP_RAW_POST_DATA is deprecated warning does not appear
#php_value always_populate_raw_post_data -1
答案 0 :(得分:0)
试试这个,这将以public / x格式删除public - >> X
RewriteEngine On
#RewriteBase /api/
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [L]
RewriteRule ^ index.php [QSA,L]