Page 4 of 18 FirstFirst 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... LastLast
Results 46 to 60 of 267
Like Tree3Likes

[How to] Setup www.yourdomain.com or yourdomain.com (www vs. non-www) - With .htaccess 301 redirects

This is a discussion on [How to] Setup www.yourdomain.com or yourdomain.com (www vs. non-www) - With .htaccess 301 redirects within the General Discussion forums, part of the vBSEO SEO Plugin category; It should work recursively... i.e. would be automatically applied to all folders accessed as a /sub/ to the root / ...

  1. #46
    Senior Member
    Real Name
    Joseph Ward
    Join Date
    Jun 2005
    Posts
    23,847
    Liked
    33 times
    Blog Entries
    9
    It should work recursively... i.e. would be automatically applied to all folders accessed as a /sub/ to the root / .

  2. #47
    Junior Member
    Real Name
    Phil
    Join Date
    May 2008
    Posts
    26
    Liked
    0 times
    What is the best way to find out why it is not? I don't mind adding the .htacess file to all the folders but I would like to understand why it's not working.

    Thanks,

  3. #48
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    It works now.
    Great!
    The root .htacess file is NOT recursive?
    IF you have .htaccess file in a subfolder, then parent .htaccess doesn't affect this folder.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  4. #49
    Junior Member
    Real Name
    Phil
    Join Date
    May 2008
    Posts
    26
    Liked
    0 times
    Quote Originally Posted by Oleg Ignatiuk View Post
    Great!
    IF you have .htaccess file in a subfolder, then parent .htaccess doesn't affect this folder.
    Ah. That explains it. I have several .htacess files in different subfolders for other applications.

    Thank you very much for the help!

  5. #50
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    You are welcome!
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  6. #51
    Junior Member
    Real Name
    Phil
    Join Date
    May 2008
    Posts
    26
    Liked
    0 times
    Well, I guess I spoke to soon. I was at work and could not test this thoroughly. Here is what I found.

    When in the site ROOT the rewrite works perfectly in all cases. That would be if the url has a trailing slash (/) or a http:// prefix or any combination of the two (without www). Example
    Code:
    jeep-cj.com, http://jeep-cj.com, jeep-cj.com/ and http://jeep-cj.com/
    is always rewritten to
    Code:
    http://www.jeep-cj.com/
    If going to the forum url without a trailing slash (/)
    Code:
    http://jeep-cj.com/forums or jeep-cj.com/forums
    using IE I get a page not found error (404). If the url HAS a trailing slash (/) with or without the http:// prefix the rewrite works.


    Under Firefox - The above is true (404 - page not found error) EXCEPT the url is rewritten to
    Code:
    http://www.jeep-cj.com/forums/home/jeepcj/public_html/forums
    regardless if the http:// prefix is used or not.


    It would seem that without the trailing slash (/) the rewrite does not function in the forum root but does function in the web root.

    Thanks for all the help

  7. #52
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  8. #53
    Junior Member
    Real Name
    Phil
    Join Date
    May 2008
    Posts
    26
    Liked
    0 times
    Wow - that was fast. I searched but did not find that. It worked and now no more 404's. I sure am learning allot!

    Thanks for the second time!

  9. #54
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    it is, but only if the folders below it don't have an htaccess themselves. since you forum folder has one, it basically overrides the root htaccess file.

    now, /someotherfolder/ will be effected by root, as it doesn't have an htaccess file in it (presumably... frontpage, etc can screw this up )

    try it out.
    make a new folder and go to the non-www version of it. it should direct to www.site.com/someotherfolder/

  10. #55
    Junior Member
    Real Name
    Tomislav
    Join Date
    Sep 2007
    Location
    Croatia
    Posts
    14
    Liked
    0 times
    Quote Originally Posted by Joe Ward View Post
    Choosing to Use the WWW version of your domain ONLY

    Edit your .htaccess file.
    At the top, add the following new lines:
    Code:
    RewriteCond %{HTTP_HOST} !^www\.example\.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]

    This works for my forum, but now i cant use my subdomains :(

    My subdomains redirect he to forum homepage.

  11. #56
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Hello,

    if your subdomains are located in a subfolder, try to create .htaccess file in it with one line:
    RewriteEngine off
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  12. #57
    Junior Member
    Real Name
    Tomislav
    Join Date
    Sep 2007
    Location
    Croatia
    Posts
    14
    Liked
    0 times
    Quote Originally Posted by Oleg Ignatiuk View Post
    Hello,

    if your subdomains are located in a subfolder, try to create .htaccess file in it with one line:
    RewriteEngine off

    Fixed, thank you very much!

  13. #58
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    You are welcome!
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  14. #59
    Member
    Real Name
    Webdzinez
    Join Date
    Nov 2008
    Posts
    41
    Liked
    0 times
    I tried using this tutorial but seems like i am missing something

    and when i try to go to
    Code:
    http://scorechase.com/gmat/
    it goes back to my front page instead of going to
    Code:
    http://www.scorechase.com/gmat/
    Here is the excerpt from the .htaccess

    RewriteCond %{HTTP_HOST} !^www\.scorechase\.com
    RewriteRule (.*) http://www.scorechase.com/$1 [R=301,L]


    could you please help

    Thanks

  15. #60
    Member
    Real Name
    Webdzinez
    Join Date
    Nov 2008
    Posts
    41
    Liked
    0 times
    Quote Originally Posted by Oleg Ignatiuk View Post
    IF you have .htaccess file in a subfolder, then parent .htaccess doesn't affect this folder.
    Well figured it out .. the above line is the crux of the solution. put similar code in all the subfolders which have .htaccess in them.

Page 4 of 18 FirstFirst 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... LastLast

Similar Threads

  1. Urgent help with htaccess and 301 redirects
    By markbolyard in forum URL Rewrite Settings
    Replies: 4
    Last Post: 12-02-2007, 05:24 PM
  2. htaccess redirects when moving folder
    By I, Brian in forum Troubleshooting
    Replies: 3
    Last Post: 10-05-2007, 02:47 PM
  3. Help with initial htaccess setup
    By mhc1576 in forum URL Rewrite Settings
    Replies: 1
    Last Post: 12-28-2006, 07:44 AM
  4. Replies: 6
    Last Post: 10-23-2005, 01:32 PM

Posting Permissions

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