301 redirect .htacces or httpd.conf?

Discussion in 'Search Engine Optimization' started by Pathan, Dec 13, 2008.

  1. #1
    Hello,

    I just came to know that its not good to have both non www and www with domain for the search engine point of view, so i have tried to redirect mysite.com to www.mysite.com with the help of .htaccess it works fine but the problem is it doesn't work for subfolders like i have sub directory abc.com/folder that directory is having its own .htacces so its not reading the root .htacces.

    The other way i have found is to do it by editing httpd.conf
    check here http://www.askdavetaylor.com/how_do_i_add_a_301_redirect_to_my_apache_httpdconf.html

    now can anybody please tell me by doing it with the help of httpd.conf will its effect be the same as that of .htaccess? and what are experts opinions about 301 redirect, whether its good for SEO or not?
     
    Pathan, Dec 13, 2008 IP
  2. jitendraag

    jitendraag Notable Member

    Messages:
    3,982
    Likes Received:
    324
    Best Answers:
    1
    Trophy Points:
    270
    #2
    .htaccess is mostly used by hosting sites when you don't have access to httpd.conf When you have access to it, redirection can be done in any of the files. I prefer .htaccess because you don't have to restart the webserver for the changes to take effect.
     
    jitendraag, Dec 13, 2008 IP
    Pathan likes this.
  3. Pathan

    Pathan Well-Known Member

    Messages:
    2,196
    Likes Received:
    218
    Best Answers:
    0
    Trophy Points:
    165
    #3
    In fact i am having my own server i just made changes in httpd.conf and its working perfect as i mentioned doing with .htaccess may trouble if you have .htaccess in sub directories
     
    Pathan, Dec 13, 2008 IP
  4. Jackie_W

    Jackie_W Well-Known Member

    Messages:
    1,964
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    115
    #4
    Sorry i cant answer your question but i've be grateful if you could give me a pointer on how to redirect using .htaccess so that all traffice goes to http://www.mysite.com rather that http://mysite.com ?
     
    Jackie_W, Dec 14, 2008 IP
  5. jitendraag

    jitendraag Notable Member

    Messages:
    3,982
    Likes Received:
    324
    Best Answers:
    1
    Trophy Points:
    270
    #5
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.mysite\.tld$ [NC]
    RewriteRule ^(.*)$ http://www.mysite.tld/$1 [R=301,L]
     
    jitendraag, Dec 14, 2008 IP
  6. Jackie_W

    Jackie_W Well-Known Member

    Messages:
    1,964
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    115
    #6
    brilliant! worked 1st time - thanks so much for that :D
     
    Jackie_W, Dec 14, 2008 IP