HTACCESS Rewrite Help!

Discussion in 'Programming' started by BillyConnite, Feb 15, 2011.

  1. #1
    Hi all,

    I'm halfway through creating a automatic free forum hosting site. I know very little about htaccess though.

    I have set everything up for dynamic subdomains, now just need the right htaccess code to do the following:

    I need first of all:
    SUB.domain.com >> domain.com/inst (static)
    However I also need:
    SUB.domain/config.php >> domain.com/configs/SUB.php

    Anyone know how to accomplish this with htaccess?

    Thanks
    Rhett
     
    BillyConnite, Feb 15, 2011 IP
  2. freshgreenlove

    freshgreenlove Well-Known Member

    Messages:
    404
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    135
    #2
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.test\.com$
    RewriteCond %{REQUEST_URI} !^/new/
    RewriteRule (.*) /new/$1

    change RED color with your domain or sub domain :)
     
    Last edited: Feb 15, 2011
    freshgreenlove, Feb 15, 2011 IP
  3. BillyConnite

    BillyConnite Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    73
    #3
    You're a genius.

    I've been working at this forever trying to figure it out. Seems to be working great!!!!!!!!!!!!!!!!
     
    BillyConnite, Feb 16, 2011 IP