Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Location
    Leeds, UK
    Posts
    5

    htaccess redirect

    I've been battling this one for ages now and have hunted high and low across a lot of forums for the answer - not even sure its possible.

    Basically, I need visitors to be able to enter

    ://w3.domain1.com/folder/any_file_of_any_type
    and be shown
    ://subdomain.domain2.com/any_file_of_any_type

    but without the domain2 url being shown in the address bar.

    I'm using shared hosting and there's no sign of a .htaccess file in my root directory - however, I can't risk putting the whole site out of action if I inadvertently overwrite the root .htaccess.

    So, I've tried the following htaccess in the folder that I want to redirect:

    RewriteEngine on
    RedirectPermanent / ://subdomain.domain2.com/ [L]

    Unfortuatenly, that only achieves redirecting as follows:

    ://w3.domain1.com/folder/any_file_of_any_type
    to
    ://subdomain.domain2.com/folder/any_file_of_any_type

    Any idea what's going wrong and how I can get around it? Any help very much appreciated

    Thanks very much,

    Ben
    P.S. please ignore the odd urls - it won't let me post a fake one.

  2. #2
    Join Date
    Dec 2001
    Location
    NYC, NY
    Posts
    798
    try this in the folder dir

    RewriteEngine on
    RewriteRule (.+) http://subdomain.domain2.com/$1 [R,L]

  3. #3
    Join Date
    Oct 2002
    Location
    Leeds, UK
    Posts
    5
    hi - thanks very much for the help.

    i've just tried that - problem is its digging up all the folders above the folder that my shared hosting uses if you see what I mean and apending them onto the end of the subdomain.domain2.com so i'm getting subdomain.domain2.com/u/web/username/thefilename.

  4. #4
    Join Date
    Oct 2002
    Location
    Leeds, UK
    Posts
    5
    incidentally, could i use a subdomain on my domain name instead to redirect using CNAME in my zone record to the external subdomain? would that achieve hiding the real url?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •