【问题标题】:How to change image path using .htaccess?如何使用 .htaccess 更改图像路径?
【发布时间】:2014-09-12 07:38:19
【问题描述】:

我有两个网站,例如,

www.example1.com
www.example2.com

example1 已经启动,并且有我需要放入我的 example2 网站的所有图像。

我想从 example1 中获取所有图像以放入我的 example2 网站,例如,

原始路径 - www.example1.com/media/img/image1.jpg

显示原始图像的网址下方,但仅更改新路径

新路径 - www.example2.com/media/img/image1.jpg

【问题讨论】:

  • 我认为您不知道 .htaccess 是什么,以及您可以用它做什么 - 或者我无法正确理解您的问题。
  • get this image and put in www.example2.com/media/img/image1.jpg 您需要进一步澄清这一行。

标签: php .htaccess url-rewriting path rewrite


【解决方案1】:

如果我理解正确,您应该在 www.example1.com/ 上的 htaccess 中使用它:

Redirect /media/img/(.*) http://www.example2.com/media/img/$1

但是请验证一下,因为我不知道语法是否 100% 正确。

【讨论】:

    猜你喜欢
    • 2012-03-30
    • 1970-01-01
    • 1970-01-01
    • 2014-02-28
    • 2017-07-08
    • 1970-01-01
    • 2013-10-19
    • 2013-01-25
    相关资源
    最近更新 更多