htaccess mod_rewrite problem

Discussion in 'Apache' started by grutland, Dec 19, 2010.

  1. #1
    The problem is, I have multiple sites pointing to one site and the settings are loaded depending on the http host.
    All of the sites should be looking at a folder with in my root directory.

    I've done this once before and got it working but can;t remember what the code is for it.
    This is what I have so far but I keep getting a server error.

    RewriteCond %{HTTP_HOST} ^(m|mobile)\. [NC]
    RewriteRule ^(.*)$ /mobile/$1 [L]
    Code (markup):
    So any thing like http://m.domain.com or http://mobile.domain.com should be a masked URL to http://m.domain.com/mobile/ or http://mobile.domain.com/mobile/
     
    grutland, Dec 19, 2010 IP
  2. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #2
    Any one got any suggestions?

    The above isn't the only code in my htaccess file.
    It start with the following:
    RewriteEngine On
    RewriteBase /
    Code (markup):
     
    grutland, Dec 20, 2010 IP
  3. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    I've got it working, there was a line I was missing by the looks of it.
    RewriteCond %{HTTP_HOST} ^(m|mobile)\. [NC]
    RewriteCond %{REQUEST_URI} !^/mobile/
    RewriteRule ^(.*)$ /mobile/$1 [L]
    Code (markup):
     
    grutland, Dec 20, 2010 IP