【发布时间】:2015-07-21 02:54:13
【问题描述】:
我有以下网址
www.example.com/index.php?tag= xxx
我想使用 .htaccess 使其如下所示
www.example.com/xxx
我用这段代码完成了:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+?)/?$ /index.php?tag=$1 [L,QSA]
如果我输入这个网址:
www.example.com/index.php?tag=1000
它被重定向到:
www.example.com/?tag=1000
如果:www.example.com/1000 它有效!
所以我有重复的 URL,这对 seo 不利。
如何将www.example.com/index.php?tag=1000 重定向到www.example.com/1000
【问题讨论】:
标签: php apache .htaccess mod-rewrite seo