.htaccess replace part of URL

ⅰ亾dé卋堺 提交于 2020-01-15 11:25:09

问题


Anyone here knows how to do this on .htaccess? I need to replace the part of URL that is inside the "[]".

Here is the URL: [http://example.com/site/second/files/]2012/08/Image.jpg
with this new URL: [http://example-two.com/media1/]2012/08/Image.jpg

Thanks in advance!


回答1:


RewriteRule ^site/second/files/(.*)$ http://example-two.com/media1/$1 [L]



回答2:


You could also use mod_alias:

Redirect 301 /site/second/files http://example-two.com/media1/


来源:https://stackoverflow.com/questions/11963402/htaccess-replace-part-of-url

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