我正在运行一个具有如下的.htaccess文件的PHP Web应用程序。
DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine On #RewriteBase / RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . %1/%2 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L] </IfModule>
它完美的工作,但谷歌试图浏览我们的url,并寻找http://www.website.com.au/questions/1234/question-name时,实际上他们是在http://www.website.com.au/1234/question-name (删除/questions/ )
我需要添加到这个.htaccess文件来删除/ questions /?
我想出了这个,但由于某种原因,它会产生一个500服务器错误,当我将它添加到RewriteRule下方和之前</IfModule>
RewriteCond %{THE_REQUEST} ^GET\ /questions/ RewriteRule ^questions/(.*) /$1 [L,R=301]
为什么这两个规则不起作用?