重定向htaccess无法正常工作

时间:2014-10-24 16:55:08

标签: regex apache .htaccess mod-rewrite redirect

我尝试使用我继承的网站重定向,我没有构建原始的htaccess

目前,当我点击Google中的about链接时,它只需要一个404登陆页面,而我希望它带我到about_us页面...

RewriteBase /
RewriteRule ^showroom$ index.php?route=showroom/showroom [L]
RewriteRule ^blog$ index.php?route=blog/home [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteRule ^about$ https://www.example.ie/about_us/ [R,L] 

1 个答案:

答案 0 :(得分:0)

您需要在内部路由规则之前保留重定向规则:

RewriteEngine On
RewriteBase /

RewriteRule ^about$ https://www.example.ie/about_us/ [R,L] 

RewriteRule ^showroom$ index.php?route=showroom/showroom [L]

RewriteRule ^blog$ index.php?route=blog/home [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^(.*)$ index.php?_route_=$1 [L,QSA]