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
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,955
    Thanks
    9
    Thanked 726 Times in 720 Posts

    .htaccess rewrite to www.domain.com fails on one directory only

    I have a rewrite rule set up in my .htaccess file to redirect non www addresses to the www address:

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^mydomain.com$
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
    This works fine, but I discovered yesterday that the rewrite fails on my 'test' directory. Specifically mydomain.com/test is not redirected to www.mydomain.com/test. All other subdirectories are redirected fine.

    I removed everything except the above statement from my .htaccess file but the problem remains.

    This makes no sense to me....Any suggestions?

  • #2
    Super Moderator
    Join Date
    Feb 2009
    Location
    England
    Posts
    539
    Thanks
    8
    Thanked 63 Times in 54 Posts
    Makes no sense to me either. Is there a test folder, and does it have a .htaccess? Are you certain there are no other .htaccess files in parent folders?
    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog

  • #3
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,955
    Thanks
    9
    Thanked 726 Times in 720 Posts
    Ah, that's it - there is (was) an .htaccess in test from ages ago. Never occurred to me. Thanks!


  •  

    Posting Permissions

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