问题
I have URL like
- www.abc.com/pqr
- www.abc.com/sss/pqr/abc
- www.abc.com/ass/pqr/asd/dff
I want to change the pqr to some other word without affecting original functionlaity.
currently I had done something like this
RewriteRule ^pqr/(.*) http://www.mysite.com/someotherword/$1 [L]
But it is affecting functionality like search, login. it is getting redirect the way i want it.
Please help
回答1:
If you want just to replace the "pqr" part, this is the rewriterule: RewriteRule ^(.)pqr(.)$ $1someotherword$2 [L]
回答2:
Sounds like the query string is missing? Try:
RewriteRule ^pqr/(.*) http://www.mysite.com/someotherword/$1 [QSA,L]
Alternates to POST data
Use GET instead.
Use a Rewrite condition to not redirect files with POST data, store the data in the database, then call a redirect file, when the file opens on the new server, load the post data from the database.
来源:https://stackoverflow.com/questions/11592509/change-part-of-url-using-htaccess