.htaccess 301重定向添加?id=

.htaccess 301重定向添加?id=,.htaccess,.htaccess,我试图将301添加到我的旧脚本中,但当我添加301时,我希望旧URL被重定向到 但是我得到了 怎么了 下面是我的htaccess文件,您可以在顶部附近看到我添加到现有代码中的301 Options +FollowSymlinks RewriteEngine On Redirect 301 /old-product.html http://www.newwebsite.co.uk/new-product.html RewriteCond %{HTTP_HOST} ^websiteone\

我试图将301添加到我的旧脚本中,但当我添加301时,我希望旧URL被重定向到

但是我得到了

怎么了

下面是我的htaccess文件,您可以在顶部附近看到我添加到现有代码中的301

Options +FollowSymlinks

RewriteEngine On

Redirect 301 /old-product.html http://www.newwebsite.co.uk/new-product.html

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

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

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

RewriteCond %{REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|php|ico|txt|less|pdf|xml)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]

ErrorDocument 404 /notfound.php

#RewriteRule contents/(.*)/(.*)$                            page.php?page_id=$1&url=$2  [NC,L,QSA]

RewriteRule login.html                                          account.php     [NC,L,QSA]

RewriteRule registration.html                               registration.php            [NC,L,QSA]

RewriteRule payment-success.html                        success.php     [NC,L,QSA]

RewriteRule forgotpassword.html                         accountforgotpass.php   [NC,L,QSA]

RewriteRule myprofile.html                                  accountloggedin.php     [NC,L,QSA]

RewriteRule editprofile.html                                accounteditdetails.php  [NC,L,QSA]

RewriteRule shopping-cart.html                          cart.php    [NC,L,QSA]

RewriteRule payment-checkout.html                       checkout.php    [NC,L,QSA]

RewriteRule checkout-password.html                checkoutenterpass.php [NC,L,QSA]

RewriteRule checkout-detail.html                    checkout2.php   [NC,L,QSA]

RewriteRule reset/(.*)/$                                    password_reset.php?vcode=$1 [NC,L,QSA]

RewriteRule (.*)$                                                       include_file.php?id=$1 [NC,L,QSA]    

您的重定向是通过重定向行完成的

Redirect 301 /old-product.html http://www.newwebsite.co.uk/new-product.html
…但文件将继续处理。最后一条规则

RewriteRule (.*)$   include_file.php?id=$1 [NC,L,QSA]
…还将捕获相同的URL并重写它

您可能要做的是将
重定向
指令替换为常规的
重写规则

RewriteCond %{REQUEST_URI} ^/old-product.html [NC]
RewriteRule ^ http://www.newwebsite.co.uk/new-product.html [R=301,L]
…这将重定向到新的URL,并使用
L
标志来避免处理文件的其余部分