301重定向单个页面导致错误的链接地址

时间:2019-06-21 05:43:30

标签: html redirect

我想将https://tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang-tolelight®.html重定向到https://tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang.html,我的代码是:

Redirect 301 /chi-tiet/15/tam-lop-lay-sang-tolelight®.html https://tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang.html

.htaccess文件:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]
#danh-muc
#RewriteRule ^(.*)/(.*)/(.*)/(.*).html$ index.php?page=$1&catid=$2&id=$3&link=$4 [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*).html$ index.php?page=$1&catid=$2&id=$3&link=$4 [L]
RewriteRule ^(.*)/(.*)/(.*).html$ index.php?page=$1&id=$2&link=$3 [L]
# lam moi tin  & xac nhan ma code quen mat khau
RewriteRule ^(.*)/(.*)/(.*)/$ index.php?page=$1&confirm_code=$2&id=$3 [L]
RewriteRule ^(.*)/(.*)/$ index.php?page=$1&id=$2 [L]

#RewriteRule ^(.*)/(.*)/$ index.php?page=$1&id=$2 [L]
RewriteRule ^(.*).html$ index.php?page=$1 [L]
#RewriteRule ^([\w]+).html index.php?page=$1 [L]
# phan trang news
RewriteRule ^([^/\.]+)/([^/\.]+)$ index.php?page=$1&start=$2 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)$ index.php?page=$1&catid=$2&start=$3 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)$ index.php?page=$1&catid=$2&key=$3&start=$4 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)$ index.php?page=$1&catid=$2&congsuat=$3&luuluong=$4&start=$5 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)$ index.php?page=$1&catid=$2&congsuat=$3&luuluong=$4&cotap=$5&start=$6 [L]
# Permanent URL redirect - generated by www.rapidtables.com
Redirect 301 /chi-tiet/15/tam-lop-lay-sang-tolelight®.html https://tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang.html
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
<IfModule mod_expires.c>
    ExpiresActive on

    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
   </IfModule>
   <IfModule mod_expires.c>
    ExpiresActive on

    ExpiresByType text/css "access plus 1 month"
 </IfModule>

但是结果是这样的: https://tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang.html?page=chi-tiet&id=15&link=tam-lop-lay-sang-tolelight%C2%AE

1 个答案:

答案 0 :(得分:0)

这是由于https://之后的评论。

因此,请尝试使用

之类的反斜杠(\
https:\\tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang.html 

代替

Redirect 301 /chi-tiet/15/tam-lop-lay-sang-tolelight®.html https://tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang.html

使用此:

Redirect 301 /chi-tiet/15/tam-lop-lay-sang-tolelight®.html https:\\tolelight.com.vn/chi-tiet/15/tam-lop-lay-sang.html

这可能有帮助。