I'm trying to do this by using .htaccess
Redirect: http://example.com/en/signup?type=something
To: http://example.com/snapshots/en_signup_type=something.html
Basically, convert all slashes and question marks to underscores and appending .html
.
I found out how to do, there are actually a few more steps than I thought.
RewriteRule ^(.*)\\/(.*)$ $1_$2 [R=301,L]
, based on the number of slashes we have, it will redirect the same amount of times, one redirection will convert one slash to one underscore. http://example.com/en/signup?type=something
-> http://example.com/en_signup?type=something
RewriteRule ^(.*)$ http://example.com/snapshots/$1_%{QUERY_STRING}.html? [P,L]
The question mark after .html is to prevent the query string to be appended again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.