为什么htaccess RewriteRule重定向网站?

时间:2013-01-28 15:29:52

标签: .htaccess

我有以下htaccess文件

redirect 301 /index.php/medical-services/botox.html http://www.mysite.ca/medical-services/toronto-botox.php
redirect 301 /index.php/about-us.html http://www.mysite.ca/about-us/
redirect 301 /index.php/contact-us.html http://www.mysite.ca/contact-us.php
redirect 301 /index.php/contact/name.html http://www.mysite.ca/contact-us.php
redirect 301 /index.php/blog/ http://www.mysite.ca/blog/
#lots of 301 redirects
redirect 301 /glisodin-skin-nutrients.php http://www.mysite.ca/

<IfModule mod_rewrite.c>
Options -Indexes
Options +FollowSymlinks

RewriteEngine On

RewriteBase /

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

RewriteRule ^mobile$ /newsite2/mobile/ [L]

RewriteRule    ^$    newsite2/    [L]
RewriteRule    (.*) newsite2/$1    [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !contests
RewriteCond %{REQUEST_FILENAME} !administrator
RewriteCond %{REQUEST_FILENAME} !shop
RewriteRule ^newsite2/(.*)$ ./newsite2/$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !contests
RewriteCond %{REQUEST_FILENAME} !administrator
RewriteCond %{REQUEST_FILENAME} !shop
RewriteRule ^(.*)$ /newsite2/$1 [QSA,L]  
</IfModule>

但是当我尝试进入时,请说:

http://skinvitality.ca/freebotox/ 它重定向到 http://skinvitality.ca/newsite2/freebotox/

我已经尝试过一切,但没有任何工作。

任何帮助都会得到真正的赞赏。

1 个答案:

答案 0 :(得分:0)

这些行:

RewriteRule    (.*) newsite2/$1    [L]
RewriteRule ^(.*)$ /newsite2/$1 [QSA,L]  

覆盖

RewriteRule (.*) http://www.skinvitality.ca/$1 [R=301,L]