Htaccess Multiple Domains To Point To Different Index.php's With Queries...

Discussion in 'Apache' started by Andi Davis, Feb 4, 2013.

  1. #1
    Hi There,

    I have never been really good at mod re-write, learning slowly. Yes it is voodo, but anyway I got by but now I've got an issue to resolve.

    We have domain1.com and domain2.uk.com... We get both to point to index.php with
    RewriteRule .([^/]+)\.html index.php [L]
    Code (markup):
    However domain2.uk.com is to look like a completely different website so needs different html structure and styles... So far I have this but I'm getting issues...

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f
     
    # NEW DOMAIN only ???? Which one - Actually none of these work ????
    #RewriteCond %{HTTP_HOST} ^domain2.uk.com$ [NC]
    #RewriteRule ^.*/$/([^/]+)\.html index_domain2.php [R=302,L]
    #RewriteCond %{HTTP_HOST} ^(.*)\.domain2.uk.com\.com$ [NC]
    #RewriteRule ^([^/]+)\.html http://www.domain2.uk.com/index_domain2.php [L,R=301]
     
    #RewriteCond %{HTTP_HOST} ^.*domain2.uk.com [NC]
    #RewriteRule ^(.*)$ index_domain2.php [R=301,L]
    #RewriteRule .([^/]+)\.html index_domain2.php [R=301,L]
     
    # NORMAL DOMAIN #
     
    #Errors Page
    RewriteRule ^/?([^/]+)/([^/]+)/(errors)/([^/]+) index.php?friendly_url=$1&view=$2&errors=$4 [L]
     
    # open page catalogue only - all items and pagination
    RewriteRule ^/?(pos)/(page)/([0-9]+) index.php?friendly_url=$1&view=catalogue&page=$3 [L]
     
    # specific to catalogue - and pagination
    RewriteRule ^/?(pos)/([0-9]+)/(page)/([0-9]+) index.php?friendly_url=$1&view=catalogue&catalogue_id=$2&page=$4 [L]
    RewriteRule ^/?(pos)/([0-9]+) index.php?friendly_url=$1&view=catalogue&catalogue_id=$2 [L]
     
    # category items and pagination
    RewriteRule ^/?(pos)/(category)/([0-9]+)/(page)/([0-9]+) index.php?friendly_url=$1&view=$2&category_id=$3&page=$5 [L]
    RewriteRule ^/?(pos)/(category)/([0-9]+) index.php?friendly_url=$1&view=$2&category_id=$3 [L]
     
    # category item options and pagination
    RewriteRule ^/?(pos)/(category-item)/([0-9]+)/(page)/([0-9]+) index.php?friendly_url=$1&view=$2&category_item_id=$3&page=$5 [L]
    RewriteRule ^/?(pos)/(category-item)/([0-9]+) index.php?friendly_url=$1&view=$2&category_item_id=$3 [L]
     
    # option no pagination needed for single product
    RewriteRule ^/?(pos)/(category-item-option)/([0-9]+) index.php?friendly_url=$1&view=$2&category_item_option_id=$3 [L]
     
    RewriteRule ^/?(pos)/(view-basket) index.php?friendly_url=$1&view=$2 [L]
    RewriteRule ^/?(pos)/(checkout) index.php?friendly_url=$1&view=$2 [L]
    RewriteRule ^/?(pos)/(process-payment) index.php?friendly_url=$1&view=$2 [L]
    RewriteRule ^/?(pos)/(send-recieve) index.php?friendly_url=$1&view=$2 [L]
     
    RewriteRule ^/?(pos)/(productAdd)/([0-9]+) index.php?friendly_url=$1&view=$2&category_item_option_id=$3 [L]
    RewriteRule ^/?(pos)/(productUpdate)/([0-9]+)/([0-9]+) index.php?friendly_url=$1&view=$2&category_item_option_id=$3&qty=$4 [L]
    RewriteRule ^/?(pos)/(productDelete)/([0-9]+)/([0-9]+) index.php?friendly_url=$1&view=$2&category_item_option_id=$3&qty=$4 [L]
    RewriteRule ^/?(pos)/(productDeleteAll) index.php?friendly_url=$1&view=$2 [L]
     
    # Easter Eggs Promotional Page
    RewriteRule ^/?(easterEggFound)/([^/]+) index.php?friendly_url=$1&uniqueCode=$2 [L]
     
    # marketing module see newsletter before sending
    RewriteRule ^/?(newsletters)/([A-Za-z0-9_]+)/(newsletter)\.html newsletters/$2/newsletter.html [L]
     
    RewriteRule ^/?(google18a519cc45d55af5)\.html google18a519cc45d55af5.html [L]
    RewriteRule ^/?(html_templates)/([^/]+)\.html  html_templates/$2.html [L]
    RewriteRule .([^/]+)\.html index.php [L]
     
    #RewriteRule ^/client-area/CLID/([0-9]+) /index.php?temp=template_dataroom&CLID=$1 [L]
     
    # allow access with no restrictions to local machine at xxx.xxx.x.x  -Disabled right now
    #RewriteCond %{REMOTE_ADDR} !xxx.xxx.x.x
     
    # allow access to all .css and .js in sub-directories..
    RewriteCond %{REQUEST_URI} !\.css$
    RewriteCond %{REQUEST_URI} !\.js$
     
    # allow access to the files inside img/, but not a directory listing..
    RewriteCond %{REQUEST_URI} !dataroom/(.*)\.
    RewriteRule ^files/([^/]+)/([^/]+).zip /download.php?section=$1&file=$2 [NC]
    # allow access to these particular files...
    Code (markup):

     
    Andi Davis, Feb 4, 2013 IP
  2. Andi Davis

    Andi Davis Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Sorry forgot to say thanks to anyone who can help me.
     
    Andi Davis, Feb 4, 2013 IP
  3. cesurasean

    cesurasean Active Member

    Messages:
    269
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #3
    What issues are you getting? Please elaborate.
     
    cesurasean, Feb 19, 2013 IP