简体   繁体   English

如何在htaccess中将动态网址重定向到相关的静态网址?

[英]How to redirect dynamic urls to their relevant static urls in htaccess?

Dynamic urls are like 动态网址就像

example.com/wp/?2323e=467467
example.com/any-page.html?2323e=567856
example.com/any-folder/other-page.html?2323e=6435346

I want to redirect them all to their static urls like 我想将它们全部重定向到他们的静态网址

example.com/wp/
example.com/any-page.html
example.com/any-folder/other-page.html

please suggest how to do this using 301 redirect 请使用301重定向建议如何执行此操作

To remove query strings, you can use : 要删除查询字符串,您可以使用:

RewriteEngine on


RewriteCond %{QUERY_STRING} .+ [NC]
RewriteRule ^ %{REQUEST_URI}? [L,R]

This will redirect : 这将重定向:

/foo?querystring

to

/foo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM