如何将所有图像从www.example.com和example.com重定向到images.example.com?简单的apache重定向
下面是一些代码,我在网上找到,但我不明白很多,如预期
编辑
#step 1 redirect ALL images from any domain to images.example.com
RewriteCond %{REQUEST_URI} ^/(.+)\.(gif|png|jpg|jpeg|jfif|bmp|css|js)$ [NC]
RewriteRule ^(.*)$ http://images.example.com/$1 [L,R=301]
#step 2 redirect non www to www
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
#step 3 redirect ALL non images from images.example.com to www.example.com
RewriteCond %{REQUEST_FILENAME} !\.(gif|png|jpg|jpeg|jfif|bmp|css|js)$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
任何帮助将非常感激这是行不通的!
谢谢!
那么你试图重写到www.example.com而不是image.example.com,所以就是这样。 – 2015-03-02 20:50:10
@Mike Brant:谢谢,我更新了我的代码...你可以看看吗? – MainHero 2015-03-02 20:54:17