【发布时间】:2014-03-01 12:37:31
【问题描述】:
我已更改网站的结构:删除 /nl/ 文件夹并将下划线切换为条纹。 所以希望是重定向旧页面: www.example.com/nl/citygames_leuven 到 http://www.example.com/citygames-leuven
重定向有点作用;但是我的干净 URL 重定向出现问题。 我被重定向到: http://www.example.com/citygames-leuven?url=nl/citygames_leuven
如你所见; url 参数粘在页面上并给出错误。
这是我目前的代码:
Options All -Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^teambuilding/(.*)/?$ teambuilding.php?url=$1 [L]
RewriteRule ^citygame/(.*)/?$ citygame.php?url=$1 [L]
RewriteRule ^meeting/(.*)/?$ meeting.php?url=$1 [L]
RewriteRule ^aanzee/(.*)/?$ aanzee.php?url=$1 [L]
RewriteRule ^vip/(.*)/?$ vip.php?url=$1 [L]
RewriteRule ^verhuur/(.*)/?$ verhuur.php?url=$1 [L]
RewriteRule ^nieuws/(.*)/?$ nieuws.php?url=$1 [L]
#Url omzetten naar index.php?page=
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ page.php?url=$1 [QSA]
Redirect 301 /nl/citygames_antwerpen http://www.example.com/citygames-antwerpen
Redirect 301 /nl/citygames_leuven http://www.example.com/citygames-leuven
Redirect 301 /nl/teambuilding/offroad_buggy http://www.example.com/teambuilding/offroad-buggy
【问题讨论】:
标签: php .htaccess mod-rewrite redirect url-rewriting