Houston to Nintendo - Redirect any subdomain, any file to new site.

Discussion in 'Apache' started by T0PS3O, Dec 4, 2006.

  1. #1
    I can't help but rely on our main man Nintendo for this sort of stuff. I did try but failed miserably.

    I have a domain.co.uk which used to be a free hosting deal so members could claim their myspam.domain.co.uk subdomain and seed the search engines with crap for free.

    I now want to 301 redirect *.domain.co.uk/* to www.otherdomain.co.uk negating all subdomains and all files and leaving therm all out in the cold.

    What's your expert solution to this? :cool:
     
    T0PS3O, Dec 4, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)$ http://www.otherdomain.co.uk/$1 [R=301,L]

    Are the sub-domains wildcard?!!! If not, placing the code in every single sub-domain is the only way I can think of doing it!!!
     
    Nintendo, Dec 4, 2006 IP
  3. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes they are, I have no idea which ones there are. The nameservers point to a 3d party solution so I'm not hosting any files, don't have anything in my httpd.conf at all.

    It literaly could be anything . mydomain.co.uk / any file . any extension. The only given is my domain name.

    Now I'm going to point the domain to my own server so I need to catch everything related to it either via htaccess or httpd.conf virtual domain to redirect.

    I don;t have access to WMW but a search pulls up something there:

    http://www.google.co.uk/search?hl=en&q=wildcard+subdomain+redirect+htaccess&btnG=Search&meta=

    http://www.webmasterworld.com/forum92/6445.htm

    On this page I found this:

    RewriteCond %{HTTP_HOST} !^example\.org$
    RewriteRule ^(.*)$ http://example.org/$1 [R=301,L]
    Code (markup):
    Isn't that more like it?
     
    T0PS3O, Dec 4, 2006 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    That looks like it does the same thing! I think that code redirects to a URL with out www.
     
    Nintendo, Dec 4, 2006 IP
  5. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'll give that a stab, thanks chief!
     
    T0PS3O, Dec 4, 2006 IP
  6. piniyini

    piniyini Well-Known Member

    Messages:
    514
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    170
    #6
    Hey TOPS did you manage to get this going?
     
    piniyini, Dec 11, 2006 IP
  7. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Haven't implemented it yet to be honest but looking at the syntax, it will be correct and work as expected.
     
    T0PS3O, Dec 12, 2006 IP
  8. amnezia

    amnezia Peon

    Messages:
    990
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #8
    all you need is

    RewriteRule ^(.*)$ http://example.org/$1 [R=301,L]

    you don't need the condition before.
     
    amnezia, Dec 12, 2006 IP