我在htaccess脚本中有这个重写规则,但是每当我在$_GET上执行$_GET时,它都是空的,就像url中的值不会在$_GET中读取一样。
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index.php/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?app=$1&page=$2&category=$3 [L]
</ifModule>url的示例:./index.php/main/特点/1
怎样才能解决这个问题?
谢谢!
发布于 2015-12-07 12:50:11
我相信这两个条件:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d不满足,因为您的URL是/index.php/main/featured/1。至少对我来说也不管用。您能否同时从index.php和RewriteRule中移除RewriteRule部件,从而生成.htaccess:
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?app=$1&page=$2&category=$3 [L]
</ifModule>并导航到URL /main/featured/1,或者如果您确实需要index.php部件,则取消注释/删除以下条件:
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d并继续使用/index.php/main/featured/1 URL。
https://stackoverflow.com/questions/34112374
复制相似问题