[英]Redirect 301 query string htaccess
I've been trying to redirect query string link to another link in my .htaccess file I've been following some guides and I figured out how to do that so at the moment the redirect is done but it doesn't really work like I would like. 我一直在尝试将查询字符串链接重定向到我的.htaccess文件中的另一个链接,我一直在遵循一些指南,并且我想出了解决方法,因此在完成重定向的同时,它确实无法像我一样正常工作想。
This is the first link: http://www.mydomain.it/index.php?page=lkr_pg_chisiamo 这是第一个链接: http : //www.mydomain.it/index.php?page=lkr_pg_chisiamo
That should be redirected to this one: https://www.mydomain.eu/chi-siamo/ 那应该重定向到这个: https : //www.mydomain.eu/chi-siamo/
This is what I've done in my htaccess in wordpress: 这是我在WordPress中的htaccess中所做的事情:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{QUERY_STRING} ^page=lkr_pg_chisiamo$
RewriteRule ^(.*)$ https://www.mydomain.eu/chi-siamo/ [R=301,L]
Now the redirect works but my final URL is: https://www.mydomain.eu/chi-siamo/?page=lkr_pg_chisiamo 现在重定向有效,但是我的最终URL是: https : //www.mydomain.eu/chi-siamo/?page=lkr_pg_chisiamo
What could the problem be? 可能是什么问题?
Now the redirect works but my final URL is: https://www.mydomain.eu/chi-siamo/?page=lkr_pg_chisiamo
现在重定向有效,但是我的最终URL是: https : //www.mydomain.eu/chi-siamo/?page=lkr_pg_chisiamo
You need to discard the query string. 您需要丢弃查询字符串。 Two solutions:
两种解决方案:
?
to reset new query string) ?
重置新查询字符串) RewriteRule ^(.*)$ https://www.mydomain.eu/chi-siamo/? [R=301,L]
RewriteRule ^(.*)$ https://www.mydomain.eu/chi-siamo/ [R=301,L,QSD]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.