Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.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
Php 使用htaccess重定向Url_Php_Apache_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

Php 使用htaccess重定向Url

Php 使用htaccess重定向Url,php,apache,.htaccess,mod-rewrite,redirect,Php,Apache,.htaccess,Mod Rewrite,Redirect,我有一个网站,我正试图迁移到一个新的主机。迁移到新主机后,由于路径不正确,所有映像都会断开 网站已迁移到: http://www.indianradio.net.au/indiantimes.com.au/ 图像路径断开,例如: http://www.indianradio.net.au/cms/fckeditor/editor/userfiles/image/Oct-14-Gaura.jpg 为了工作,路径需要是: http://www.indianradio.net.au/indiantim

我有一个网站,我正试图迁移到一个新的主机。迁移到新主机后,由于路径不正确,所有映像都会断开

网站已迁移到:

http://www.indianradio.net.au/indiantimes.com.au/

图像路径断开,例如:
http://www.indianradio.net.au/cms/fckeditor/editor/userfiles/image/Oct-14-Gaura.jpg

为了工作,路径需要是:

http://www.indianradio.net.au/indiantimes.com.au/cms/fckeditor/editor/userfiles/image/Oct-14-Gaura.jpg

将URL更改为以下内容的最佳方式是什么:

http://www.indianradio.net.au/indiantimes.com.au/

所以它们都能正常工作

我的印象是我可以用.htaccess来做这件事,但我不知道怎么做。任何帮助都将不胜感激!谢谢

你可以用这个:

RewriteCond%{REQUEST\u URI}/indiantemes.com.au/*
重写规则^(.*\(gif | jpg | png))$indiantemes.com.au/$1[L]
-未测试

但我强烈建议找到一种方法来更改脚本中的图像路径,并
不使用htaccess。

您没有更改映像路径的位置吗?htaccess不是一个好主意,因为其中的所有规则都会在每个请求中被解析。。