如何將所有圖像從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