我以前经常用爆炸功能来做SEO url,比如:
site.com/?/category/id/topicname/ (or site.com/index.php?/category/id/topicname/)但是,我开始使用.htaccess。但我现在有麻烦了。老裁判员达不到这篇文章。我怎样才能改变网址:
来自:site.com/?/category/id/topicname/
致:site.com/category/id/topicname/
和
来自:site.com/index.php?/category/id/topicname/
致:site.com/category/id/topicname/
编辑:我的.htaccess文件:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
RewriteRule ^([0-9a-zA-Z-_]+)/$ index.php?modul=$1 [L,QSA]
RewriteRule ^([0-9a-zA-Z-_]+)$ index.php?modul=$1 [L,QSA]
RewriteRule ^([0-9a-zA-Z-_]+)/([0-9]+)\/?$ index.php?modul=$1&id=$2 [L,QSA]
RewriteRule ^([0-9a-zA-Z-_]+)/([0-9]+)/([0-9a-zA-Z-_]+)\/?$ index.php?modul=$1&id=$2 [L,QSA]发布于 2013-11-19 10:03:30
将以下指令添加到您的.htaccess中,第一个条件断言以前没有重定向(否则,它将是一个无穷无尽的循环)
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteCond %{QUERY_STRING} ^/(.+)$
RewriteRule ^(index\.php)?$ /%1? [NC,R=301,L]https://stackoverflow.com/questions/20066964
复制相似问题