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 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2011
    Location
    Manchester U.K
    Posts
    30
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Problems setting up www. redirects

    Hi there, I've recently been informed that most of my site maybe misinterpreted by search engines as I don't have 301 redirects set-up and therefore a lot of my pages are appearing as duplicates, a www. version and one without.

    So far I've been following this guide on how to set-up the redirects I need:

    http://www.squidoo.com/301

    In one of the first steps it mentions you need apache, which I'm not sure if my host has (1and1.co.uk)

    There is also a step to locate the file httpd.conf on my server but i cannot find it anywhere. I've followed all of the other instructions but when I go to my site williammorrismusic.com it doesn't redirect to the www. version. Any ideas?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You'll only be able to access the httpd.conf if you have full control of the machine. If its a shared hosting, you need to cross your fingers that they allow .htaccess to override the type.
    All that article (just briefly looked over the code used) looks like it will work in the .htaccess except the directives in the block for Options +..., which I believe can only be set in httpd.conf, and the loadmodule I think is also httpd.conf level only.
    Simply use:
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mysite.com
    RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]
    should work.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    will_m (03-22-2011)

  • #3
    New Coder
    Join Date
    Mar 2011
    Location
    Manchester U.K
    Posts
    30
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Ah I've just discovered I don't have apache as I'm on a windows server so the redirects will have to be done like so:

    http://faq.oneandone.co.uk/scripting/asp_net/10.html

    Does that code need to go on every page then?


  •  

    Posting Permissions

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