我有一个子域(us.example.com)和主域(example.com)。我想重定向我的子域名只有一个特定图像的主域名。例如,如果我点击http://us.example.com/images/test.jpg
那么它应该重定向到http://example.com/images/test.jpg
htaccess重定向用于加载从主域的子域中的特定图像url
我想301下面的重定向,但它不工作。
Redirect 301 https://us.example.com/images/test.jpg https://example.com/images/test.jpg
我已经尝试过其他规则还,但他们不是在目录中的特定图像的完整图像目录中的所有工作。
更新 更改后的规则是这样 -
RewriteCond %{HTTP_HOST} ^us\.example\.com$ [NC] RewriteRule ^/?images/test.jpg$ https://example.com/images/test.jpg [R=301,L]
,但没有运气。
请贴上你的。否则htaccess文件就这个链接http://stackoverflow.com/questions/20677792/rewrite-subdomain-to-main-domain-for-images-only-using-htaccess – Kate
感谢一下@Kate觉得我完全不.htaccess文件需要在这里。我已经粘贴了我申请的规则。对于你的链接,我已经提到这个,但它在完整的目录上工作,我只想为单个图像设置规则。 –