Domain Manage

url redirecting using htaccess

Discussion in 'Website Design' started by SecNam, May 15, 2010.

Thread Status:
Not open for further replies.
  1. SecNam

    SecNam Moderator Staff Member

    Joined:
    Jul 2004
    Posts:
    5,118
    Likes Received:
    37
    i am looking for a way to redirect urls when a user visits the page using .htaccess

    for example

    domain1.co.uk
    domain2.co.uk
    domain3.co.uk

    are all parked on domain.co.uk

    when a user goes to domain1.co.uk i want to divert them to domain.co.uk/domain1

    i used to have this but can not find it so any help much appreciated.
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. retired_member21

    retired_member21 Retired Member

    Joined:
    Apr 2008
    Posts:
    742
    Likes Received:
    13
    ..........
     
    Last edited: May 15, 2010
  4. atlas Canada

    atlas Well-Known Member

    Joined:
    Oct 2007
    Posts:
    1,237
    Likes Received:
    28
  5. SecNam

    SecNam Moderator Staff Member

    Joined:
    Jul 2004
    Posts:
    5,118
    Likes Received:
    37
    sussed it

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.)?domain1.co.uk [NC]
    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^(.*) http://www.domain.co.uk/domain1/$1 [L,R=301]
     
  6. bensd United Kingdom

    bensd Well-Known Member Exclusive Member

    Joined:
    Jan 2007
    Posts:
    4,937
    Likes Received:
    51
    Does that rule now work for all domains you forward or just domain1.co.uk?
     
  7. SecNam

    SecNam Moderator Staff Member

    Joined:
    Jul 2004
    Posts:
    5,118
    Likes Received:
    37
    just domains1
     
  8. SecNam

    SecNam Moderator Staff Member

    Joined:
    Jul 2004
    Posts:
    5,118
    Likes Received:
    37
    just thought i would open an old thread rather create a new one.

    Is it possible to create the above using wildcard for a domain/url.

    so instead of using the following per domain:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.)?domain1.co.uk [NC]
    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^(.*) http://www.domain.co.uk/domain1/$1 [L,R=301]

    have it so it is seens for example tfts.co.uk it will divert to /tfts/
    or domain1.co.uk goes to /domain1/
     
Thread Status:
Not open for further replies.

Share This Page