[英].htaccess redirect url with parameters in a new url
I need to redirect my old link(deleted) in my new link with a .htaccess file, for example,我需要使用 .htaccess 文件在新链接中重定向旧链接(已删除),例如,
From: http://www.example.com/page.php?value=2 (deleted)
To: http://www.example.com/detail.php?d=150
RewriteRule
directive does not receive the entire url, but the part of URI relative to the directive your htaccess
file is inside. RewriteRule
指令不会接收整个url,但是URI中与htaccess
文件相对的指令部分位于其中。 Also, it doesn't receive the query parameters, you'll have to access them with the RewriteCond
directive . 另外,它不接收查询参数,您必须使用
RewriteCond
指令访问它们。 So, it should be: 因此,应为:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^value=2$
RewriteRule ^page.php$ /detail.php?d=150 [R=301,L,QSD]
Try : 尝试:
RewriteEngine on
RewriteCond %{THE_REQUEST} /page\.php\?value=2$
RewriteRule ^ http://example.it?page.php?d=150 [L,R]
This would redirect 这将重定向
to 至
Reference : https://httpd.apache.org/docs/current/mod/mod_rewrite.html 参考: https : //httpd.apache.org/docs/current/mod/mod_rewrite.html
I have links like this: www.domain.com/en/Ads-3-Picardie-Aisne-Caravans-camper-cars-Demo03-Pro-Acc
I want to redirect links to (change the world with big letter 'Ads' with 'ads'): www.domain.com/en/ads-3-Picardie-Aisne-Caravans-camper-cars-Demo03-Pro-Acc
And the - htaccess is:我有这样的链接:
www.domain.com/en/Ads-3-Picardie-Aisne-Caravans-camper-cars-Demo03-Pro-Acc
我想将链接重定向到(用大写字母“广告”改变世界'ads'): www.domain.com/en/ads-3-Picardie-Aisne-Caravans-camper-cars-Demo03-Pro-Acc
而 - htaccess 是:
RewriteRule ^(fr|en|es|it)/Ads-([0-9]+)-[a-zA-Z0-9-]+$ ad_page.php?id_ad=$2&lang=$1 [L]
### Rewriting ulrs ads, shops and page whithout language ###
RewriteRule ^Ads-([0-9]+)-[a-zA-Z0-9-]+$ ad_page.php?id_ad=$1 [L] ```
Thank you.谢谢你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.