SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    strange problem browser removing www. from URL's

    Hi guys,

    This is the first time I've come across this problem when all config files are set correctly.

    I have a domain that's been working perfectly fine for many years, since last week when i type in the url, for example:

    www.demo.com/subfolder

    my browser and all my user's browsers goes to load www.demo.com but upon reaching the page the URL changes to: http://demo.com/subfolder - losing the www. prefix. If you then manually edit the URL once you've navigated there putting in the WWW. yourself and hittin enter - the website will return the correct URL. Weird!

    This is causing problems with a number of scripts whos config files are set for the live site to contain the www.

    Nothing has been changed on site, I've contacted my hosting company who over 4 days haven't really helped.

    Going to the root of the domain isn't a problem as the www remains. - all the directories are suffering from the problem.

    My host asked me to put this in my Htaccess file, but it doesn't seem to of made any difference, I've put this in an htaccess file both in my root and a test subfolder:

    RewriteCond %{HTTP_HOST} !^www.demo.com [NC]
    RewriteRule ^(.*)$ http://www.demo.com/$1 [R=301,L]
    But still no joy :S Your help would be greatly received. Thank you!

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,682
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    j6,

    I thought I answered this almost an hour ago! Deja vu (all over again)!

    Anyway, your host does NOT know regex and believes that you're using Apache 2.x. If not:
    Code:
    RewriteCond %{HTTP_HOST} !^www\.demo\.com$ [NC]
    RewriteRule ^/?(.*)$ http://www.demo.com/$1 [R=301,L]
    Actually, I don't believe that's the problem. I suspect that you have a Redirect statement in your subfolder directory's .htaccess since the problem doesn't show up until you go there.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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