Change Part of URL using htaccess

前提是你 提交于 2019-12-14 03:12:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!