我正在尝试.htaccess将images / icon.png重定向到images / [subdomain] _icon.png ..
喜欢:
demo.domain.com/images/icon.png to demo.domain.com/images/demo_icon.png
test.domain.com/images/icon.png to test.domain.com/images/test_icon.png
abc.domain.com/images/icon.png to abc.domain.com/images/abc_icon.png
重定向应该是通用的,而不是固定的。任何子域都应该添加_icon.png ..
[subdomain].domain.com/images/icon.png -> [subdomain].domain.com/images/[subdomain]_icon.png
请告知..
答案 0 :(得分:1)
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ([^.]+)\.yourdomain\.com$ [NC]
RewriteRule ^images/icon\.png http://%1.yourdomain.com/images/%1_icon.png [R=301,L]
这个例子需要测试......