showthread.php and forumdisplay.php not following .htaccess redirect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hilary
    Senior Member
    • Oct 2005
    • 193
    • 4.1.x

    [Forum] showthread.php and forumdisplay.php not following .htaccess redirect

    Hi everyone,

    This is an issue I have seen a few times on the forums - but still can't seem to find answers.

    We have the following code in our .htaccess

    Code:
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    Note: The 'RewriteEngine On' was declared earlier in the file.

    We have the forum in a sub-directory, and the .htaccess with the rule is in the root directory.

    All other parts of the site are following the redirect - but the forum pages are not.

    I should also mention that when you try to visit the forum at domain.com.au/forum/showthread.php..... - the page enters an infinite loop and doesn't actually properly load.

    What could be causing this? Are there settings in admincp that I need to fix?

    Thanks,
    hilary
  • Mark.B
    vBulletin Support
    • Feb 2004
    • 24287
    • 6.0.X

    #2
    Why are you redirecting these files?
    Other than when using mod_rewrite friendly URLs, vB4 does not need an .htaccess file. We can't support any custom redirects.
    MARK.B
    vBulletin Support
    ------------
    My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
    My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

    Comment

    • hilary
      Senior Member
      • Oct 2005
      • 193
      • 4.1.x

      #3
      Hi Mark,

      We are redirecting domain.com.au to www.domain.com.au.

      These are seen as two different URL's by Google - and we would like to send everyone to the www - for the purpose of optimising SEO.

      Apart from the redirect not working - what would cause the threads to just keep loading?

      It's only when you leave the www. off that it enters the loop.

      Thanks

      Comment

      • ozzy47
        Senior Member
        • Oct 2009
        • 215

        #4
        I use this, and have not seen any loops.

        Code:
        RewriteCond %{HTTP_HOST} ^www.MYSITE.com [NC]
        RewriteRule ^(.*)$ http://MYSITE.com/$1 [L,R=301]
        My Mods also available at OzzModz.com

        New vBulletin Spider Definitions, vBulletin Spiders List Hits 1000 Spiders!
        Stop Spam Now The era of Big Spam is over.

        Vote to bring back hooks in vB5, http://tracker.vbulletin.com/browse/VBV-10333

        Comment

        • hilary
          Senior Member
          • Oct 2005
          • 193
          • 4.1.x

          #5
          Hi ozzy47,

          Thanks for that. I feel like something is happening on the forum before it gets a chance to look at the .htaccess - which can't be the case because it should be looking at the .htaccess first.

          I just don't know why or how it gets into the loop.

          I watched the logs when this happens, and it just keeps requesting the page.

          Thanks

          Comment

          • hilary
            Senior Member
            • Oct 2005
            • 193
            • 4.1.x

            #6
            UPDATE

            Found an old script in a header include file that was redirecting the page based on the subdomain - somehow this was causing URL's with no www to get stuck in a loop while trying to resolve the URL.

            After removing the script, the page loaded - however the .htaccess redirect from the root still wasn't taking effect (non www to www)

            After placing the redirect rule into the forum directories .htaccess the page redirect correctly.

            So I'm not sure why it wouldn't follow the roots .htaccess - but hey, it's working.

            Comment

            • donald1234
              Senior Member
              • Oct 2011
              • 1953
              • 4.1.x

              #7
              The above code is for directing www. to non www., you should use this
              Code:
              RewriteCond %{HTTP_HOST} ^yoursite\.com$
              RewriteRule (.*) http://www.yoursite.com$1 [R=301,L]
              for nonwww. to www.

              Comment

              Related Topics

              Collapse

              Working...