I canβt 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]
It works as expected. Redirecting images to another 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 everything no matter what. What I want to see is redirect everything except images. What I'm trying to do in my rules above is to redirect all subdomains of market.mysite.com to market.mysite.com if it is not market.mysite.com, and if it is not an image. In other words:
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 a wildcard subdomain, so all my sub-domains of the market will use the same directory. And then it answers all requests with a single php file. index.php
Thanks,
source share