Rewrite both domain and path

落爺英雄遲暮 提交于 2019-12-08 18:50:33

From the top of my head:

RewriteRule ^http://www.example.com/test/ex.gif$ http://static.example.com/ex.gif [NC,R=301]

or to any file in test:

RewriteRule ^http://www.example.com/test/(.*)$ http://static.example.com/$1 [NC,R=301]

Corrected after advice from Mr. Berardi

Try this mod_rewrite rule:

RewriteEngine on
RewriteRule ^test/(.*) http://static.example.com/$1

Or this mod_alias directive:

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