Forum Moderators: phranque
I have following problem when using mod_rewrite for automatic 3rd level domains:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9]*)\.domain\.com$
RewriteRule ^(.*)$ /%1/$1
RewriteCond %{HTTP_HOST} ^www\.([a-zA-Z0-9]*)\.domain\.com$
RewriteRule ^(.*)$ /%1/$1
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ /www/$1 [L]
It works fine with Mozilla or Firefox, but with MSIE there is a problem - MSIE does not store served files into cache, simply no file from rewrited website is saved into IE's cache. Does anyone know how to fix this bug? Thanx.
Welcome to WebmasterWorld!
Since you are doing internal rewrites rather than external redirects, there is no way for the client to know that you have rewritten anything; the action takes place entirely within your server. Therefore, MSIE's behaviour is not related to the rewrite code you have posted, but due to some other factor. A cache-control setting, or the use of scripts generating dynamic output might be the cause.
You can combine your first two rules like this:
RewriteCond %{HTTP_HOST} ^[b](www\.)?[/b]([a-z0-9]*)\.domain\.com$ [b][NC][/b]
RewriteRule ^(.*)$ /[b]%2[/b]/$1 [L]