mod_rewrite在本地主机上不起作用,但在实时服务器上起作用。我已经阅读了很多关于stackoverflow的文章,并尝试了所有方法,但没有任何效果。
我正在尝试在xampp(localhost / afrihub)的开发计算机上使用它。我将.htaccess放在我的afrihub目录中(我也尝试删除RewriteBase,但仍然无法正常工作!)。
我的mod_rewrite代码是:
RewriteEngine on
RewriteBase /afrihub/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^/?([a-zA-Z_]+)$ index.php?p=$2 [NC,L]
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)$ index.php?p=$1&c=$3 [NC,L]
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([0-9]+)$ index.php?p=$1&c=$2&id=$4 [NC,L]'
我到底缺少什么或没有写东西?为什么它可以在实时服务器上无缝运行,而不在本地主机上运行?