.htaccess无法重定向网址

时间:2013-12-05 11:29:25

标签: .htaccess

我们有一个在开放式购物车上开发的项目。我们有一些URL,如果用户点击这些URL,系统会将用户重定向到另一个指定的URL。为此,我们在.htaccess文件中进行了一些更改。

这是我原来的.htaccess文件代码:

RewriteBase /  
RewriteCond %{HTTP_HOST} !^www\.  
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]  

RewriteRule sitemap.xml /index.php?route=feed/google_sitemap  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]  

现在要重定向,我们在下面添加了以下几行:

Redirect 302 http://www.covermale.com/index.php?route=product/manufacturer/info&manufacturer_id=23 http://www.covermale.com/obviously  

但我们的系统无法重定向到http://mensuas.veldev.com/obviously 任何人都可以告诉我们,上述规则有问题吗?

2 个答案:

答案 0 :(得分:0)

试试这个例子:

RewriteEngine  on

RewriteCond %{query_STRING} ^route=product/manufacturer/info&manufacturer_id=23$
RewriteRule ^index\.php$ http://www.covermale.com/obviously? [R=301,L]

答案 1 :(得分:0)

让你的.htacces像这样:

RewriteEngine on
RewriteBase /

RewriteCond %{query_STRING} route=product/manufacturer/info&manufacturer_id=23 [NC]
RewriteRule ^index\.php$ /obviously? [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.  
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]  

RewriteRule sitemap.xml /index.php?route=feed/google_sitemap  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]