Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    301 redirect of index.html also redirects subdomain....

    How can I successfully do:


    redirect 301 /index.html www.mysite.com/page.extension


    without


    subdomain.mysite.com being redirected as well


    Any help would be appreciated.

  • #2
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    I'm assuming you have the code in an .htaccess file. Either...

    Have the sub-domains DocumentRoot different to the main one, so that it never hit the file (unlikely to be useful as you are obviously using the same code base).
    Move the code into the VirtualHost for the main domain (probably haven't got access to it, especially if you're on shared hosting).
    Use mod_rewrite to redirect instead.

    Code:
    RewriteCond %{HTTP_HOST} ^www.mysite.com
    RewriteRule index.html /page.extension [R=301,L]


  •  

    Posting Permissions

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