301 перенаправление одной страницы приводит к неправильному адресу ссылки - PullRequest
0 голосов
/ 21 июня 2019

Я хочу перенаправить 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 голосов
/ 21 июня 2019

Это из-за комментария после 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

Это может помочь.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...