Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2002
    Location
    UK
    Posts
    837

    redirecting contents of a subdomain to antoher url

    Hi Guys

    Can anyone tell me how to redirect a subdomain and all the contents into it to another URL

    for example say i have the following website

    something.mywebsite.com

    now every single file within that subdomain how do i do it so that it redirects to another location?

    So say i had a file called

    http://something.subdomain.com/afold.../somefile.html

    each time someone tries to access that somefile.html it gets directed to another URL

    likewise the same thing with files in the root aswell
    in other words what im saying the entire contents in public_html folder each time soemoen tries to acces a file within it it gets redirected be it images or html

  2. #2
    for a subdomain, your control panel should have some sort of "redirection" feature, were you can force a client who visits the subdomain, to be redirected to another URL, for root public_html you should place an .htaccess file in there, thats if you have apache :-P

  3. #3
    Join Date
    Dec 2002
    Location
    UK
    Posts
    837
    Yup i got Apache running

    what do i put in that .htacess file for root?

    cheers!

  4. #4
    Join Date
    Dec 2001
    Location
    NYC
    Posts
    1,902
    You want mod_rewrite.

  5. #5
    Join Date
    Dec 2002
    Location
    UK
    Posts
    837
    Hi thanks for your reply

    I had a look and found this:


    http://www.widexl.com/scripts/docume...d_rewrite.html

    and there is code somewhere on that page which shows:

    ---------------------
    Redirect visitor by domain name

    DESCRIPTION: In some cases the same web site is accessible by different addresses, like domain.com, www.domain.com, www.domain2.com and we want to redirect it to one address.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L]

    EXPLAIN: In this case the requested URL http://domain.com/foo.html would redirected to the URL http://www.domain.com/foo.html.

    ----------------

    is that the kinda thing i want? If so do i create a blank .htaccess file and post that code on? and if so where do i save it under? Public_html?

    any help wud be appreicated

    Thanks!

  6. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Posting Permissions

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