I cant understand why but:
RewriteCond %{HTTP_HOST} market\.mysite\.com$ [NC]
RewriteCond %{HTTP_HOST} !^market\.mysite\.com$ [NC]
RewriteCond %{REQUEST_URI} \.(png|jpe?g|bmp|gif|swf|css|js)$ [NC]
RewriteRule ^(.*) http://market.mysite.com/$1 [L,R]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
Works as expected. Redirecting images to an other domain. But this one:
RewriteCond %{HTTP_HOST} market\.mysite\.com$ [NC]
RewriteCond %{HTTP_HOST} !^market\.mysite\.com$ [NC]
RewriteCond %{REQUEST_URI} !\.(png|jpe?g|bmp|gif|swf|css|js)$ [NC]
RewriteRule ^(.*) http://market.mysite.com/$1 [L,R]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
Will redirect all no matter what. What I want to see is to redirect all except images. What I am trying to do in my rules above is to redirect all sub-domains of market.mysite.com to market.mysite.com if it wasn't market.mysite.com and if it wasn't an image. In another word:
cdn.market.mysite.com -> market.mysite.com
cdn.market.mysite.com/blahblah.html -> market.mysite.com/blahblah.html
cdn.market.mysite.com/blahblah.png -> NO REDIRECT
market.mysite.com -> NO REDIRECT
I use wildcard sub-domain so all of my market sub-sub-domains will use same directory. And then responding to all of requests by one php file. index.php
Thanks,