Rewrite works differently on Linux than Windows?

Discussion in 'Apache' started by Col_Crunch, Jan 27, 2015.

  1. #1
    So I used to use windows for my apache server, but I decided to move to linux recently.

    I had been using the following in my vhosts file, rather than adding a new entry for each site...

    
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www
            RewriteEngine On
            #www.domain.tld
                    RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.([^.]+)
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteRule ^(.*)%$ /%1.%2/$1 [L]
            #end www.domain.tld
            #subdomain.domain.tld
                    RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.([^.]+)
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteRule ^(.*)$ /%1.%2.%3/$1 [L]
            #end subdomain.domain.tld
            #domain.tld
                    RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteRule ^(.*)$ /%1.%2/$1 [L]
            #end domain.tld
    
    
    </VirtualHost>
    
    Code (markup):
    My issue comes with the www[DOT]domain[DOT]tld section... it worked perfectly on windows, but on Linux it always redirects to / (which is off limits for obvious reasons).

    Help?
     
    Col_Crunch, Jan 27, 2015 IP