.htaccess mod_rewrite remap without redirection?

雨燕双飞 提交于 2020-01-07 04:18:06

问题


I'm using the following to redirect http://example.com/somedir/?_escaped_fragment=key=val to http://example.com/somedir/static/?key=val.

RewriteBase /
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteCond %{QUERY_STRING} ^_escaped_fragment=(.*)$
RewriteRule ^(.*)$ %{ENV:BASE}static/?%1 [L,R=302]

How can I hide the URL change? I'd like to avoid using mod_proxy, if possible.


回答1:


Simply remove the ,R=302 for an internal redirect, see: http://httpd.apache.org/docs/2.4/rewrite/remapping.html



来源:https://stackoverflow.com/questions/31649101/htaccess-mod-rewrite-remap-without-redirection

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