Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess替换URL的一部分_.htaccess_Redirect - Fatal编程技术网

.htaccess替换URL的一部分

.htaccess替换URL的一部分,.htaccess,redirect,.htaccess,Redirect,这里有人知道如何在.htaccess上执行此操作吗?我需要替换位于[]内的URL部分 以下是网址:[http://example.com/site/second/files/]2012/08/Image.jpg 使用此新URL:[http://example-two.com/media1/]2012/08/Image.jpg 提前谢谢 您也可以使用mod_别名: RewriteRule ^site/second/files/(.*)$ http://example-two.com/media1/

这里有人知道如何在.htaccess上执行此操作吗?我需要替换位于[]内的URL部分

以下是网址:[http://example.com/site/second/files/]2012/08/Image.jpg 使用此新URL:[http://example-two.com/media1/]2012/08/Image.jpg


提前谢谢

您也可以使用mod_别名:

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

您还可以使用mod_别名:

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