My site has weird behavior. It wont work without www

Discussion in 'Programming' started by engedi05, Aug 25, 2009.

  1. #1
    Hi, here is my exact problem.

    Site works before i move to new server.

    I give you an example.

    When i click on this link:

    http://hyipsensor.net/board/showthread.php?t=22833

    it will redirect it to:

    http://www.hyipsensor.net/?t=22833

    That is a madness. It even rewrite the link.


    But if i put www in the url, it works very well:

    http://www.hyipsensor.net/board/showthread.php?t=22833



    I suspect it has something to do with rewrite engine. Following is my .htaccess file:

    Could any expert take a look at it and give me some suggestions.. i have been trying whole nites. Thanks a lot.
     
    engedi05, Aug 25, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could remove this:

    
    RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^hyipsensor.net$ "http\:\/\/www\.hyipsensor\.net" [R=302,L]
    
    RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^www.hyipsensor.net$ "http\:\/\/www\.hyipsensor\.net" [R=302,L]
    
    Code (markup):
    basically since if you don't care if its www or not www , then removing the above will allow either to get to the domain. Though I wonder what prompted you or the host to put that rule in the first place.
     
    kblessinggr, Aug 25, 2009 IP
  3. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    By the way , without [L] on the end of your first RewriteRule, the execution will continue on to the next rule, so probably better putting that first RewriteRule last, so that criterias such as IP blockage and such happens prior to the rewrite evaluation.
     
    kblessinggr, Aug 25, 2009 IP
  4. engedi05

    engedi05 Well-Known Member

    Messages:
    596
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    120
    #4
    I have removed the both rules, but same thing happen to my site..

    Both rules were always there since my old server. Can it be that something wrong with the server? Maybe it is not the .htaccess problem?

    I do not quite get you in this one.. please guide me further.. thanks.
     
    engedi05, Aug 25, 2009 IP
  5. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Whatever this does:
    RewriteRule hyip-(.*)-(.*)\.htm$ /?a=$1&lid=$2

    continues onto the other rules even if a match is hit.
    adding a [L] at the end stops the processing if matched. Not sure if thats of importance to you or not.

    By the way who is the new host, and if you completely removed the .htaccess for a moment does the www/no-www problem persist?
     
    kblessinggr, Aug 25, 2009 IP
  6. pneulameiro

    pneulameiro Peon

    Messages:
    440
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Maybe it is your dns setting on your host server (dns custom record), probably the cname field.
     
    pneulameiro, Aug 25, 2009 IP