1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 Trailing slash causing redirect loop

Discussion in 'Troubleshooting and Problems' started by Chris D, Mar 27, 2012.

  1. Chris D

    Chris D XenForo Developer Staff Member

    I have a desire to enable full friendly URLs on my site.

    This is working great on my dev site, where I cannot replicate this error.

    But I am experiencing an odd redirect loop. The error can be reproduced with, or without the full friendly URL function enabled.

    It is currently disabled, yet if I go to http://www.valvetime.net/forum Xenforo redirects me correctly to http://www.valvetime.net/index.php?forum.

    If I add a trailing slash and go to http://www.valvetime.net/forum/ then I experience the error. I am incorrectly redirected to http://www.valvetime.net/forum/index.php?forum/

    To make things more sinister, when full friendly URLs are enabled, then URL will cause the loop, trailing slash or not.

    Any idea what causes this?

    Advice greatly appreciated! :)
  2. mrGTB

    mrGTB Well-Known Member

    Have you checked your Board URL setting entered. Make sure it's entered correctly "without a trailing slash". That's all I can think could possibly be causing the issue, wrong URL entered (maybe).
  3. Chris D

    Chris D XenForo Developer Staff Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Try uncommenting this line in the .htaccess file:

    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	#	If you are having problems with the rewrite rules, remove the "#" from the
    	#	line that begins "RewriteBase" below. You will also have to change the path
    	#	of the rewrite to reflect the path to your XenForo installation.
    	#RewriteBase /xenforo
    	#	This line may be needed to enable WebDAV editing with PHP as a CGI.
    	#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    	RewriteCond %{REQUEST_FILENAME} -f [OR]
    	RewriteCond %{REQUEST_FILENAME} -l [OR]
    	RewriteCond %{REQUEST_FILENAME} -d
    	RewriteRule ^.*$ - [NC,L]
    	RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    	RewriteRule ^.*$ index.php [NC,L]
    Just a guess.
  5. Chris D

    Chris D XenForo Developer Staff Member

    Only problem I can foresee with that is that the path to our Xenforo installation is just / so I assumed that is the same as leaving that line commented?

    I might be wrong.

    And it also doesn't explain why the redirect loop still happens even if the .htaccess file isn't in use.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It shouldn't, assuming the .htaccess file is removed or renamed to something else.

    If you continue to have problems then I can take a look if you give me a FTP login to your server.
  7. Chris D

    Chris D XenForo Developer Staff Member

    Thank you for the offer - might take you up on that but we have a server/web expert and he's already as confused as anything. The configuration of the site is identical to our dev site yet only the live site has the problem.

    However, maybe I haven't given enough info.

    I've worked a couple of things out. I personally got involved after XenPorta was installed so this may be causing our problems.
    The above is true for us. http://www.valvetime.net is our XenPorta home page. http://www.valvetime.net/forumis our forum home page.

    So I'm going to kinda blame XenPorta but I still don't know why it would cause a problem on our live site but not our dev site.

    Even with no .htaccess file in place and full friendly URLs off we get a redirect loop if you go to http://www.valvetime.net/forum/ (with a trailing slash).

    Really have no idea now :(
  8. mrGTB

    mrGTB Well-Known Member

    Just an observation here, why have you uploaded "htaccess.txt" to your web server? You have two there now, one in txt format, the other as it should be using .htaccess (I think). The TXT one should not be uploaded, it's only included as a (backup) file of the .htaccess. The only reason you would upload the TXT version, is once uploaded you then rename it on server end using your FTP program from "htaccess.txt" to ".htaccess".

    Please "Double check", just to be 100% sure! That you don't only have one htaccess file uploaded, and that it's in TXT format. Because usually I'd be denied access to view a .htaccess file, so both links I posted below could actually be same TXT file really, I'm not too sure? If you only have the TXT version uploaded, there's your problem!

    1: http://www.valvetime.net/htaccess.txt (don't upload this one)
    2: http://www.valvetime.net/htaccess
  9. Chris D

    Chris D XenForo Developer Staff Member

    Well the htaccess.txt is included in the upload folder of the full XF package so when I uploaded everything to upgrade from 1.1.1 to 1.1.2 earlier it copied that across as well.

    However, I've deleted both the .htaccess and htaccess.txt files now.

    Yet the redirect loop still exists:

  10. mrGTB

    mrGTB Well-Known Member

    Try uploading just the .htaccess file, but you said it was there before anyway "you just deleted both". As only that should be there, the .htaccess one. Just a shot in the dark after seeing you had the TXT one, wondered if you only had that uploaded by mistake.

    Also, why are you posting a link that includes a "forum" sub-directory.

    Because when I visit your forum board it shows as not being installed in any "sub-directory", but in the ROOT.

    You've not un-commented this line have you (removed the # "hash" symbol)

     #RewriteBase /xenforo
  11. Chris D

    Chris D XenForo Developer Staff Member

    It's nothing to do with the .htaccess file. I only need the .htaccess file when I turn on Full Friendly URLs.

    That functionality is currently disabled, so whether I have the .htaccess file uploaded or not is irrelevant.

    Currently as far as the users on my site are concerned, everything is functioning normally.

    If I re-upload the .htaccess file and turn on Full Friendly URLs then any forum link causes the redirect loop.

    The reason I am linking to the forum sub directory is a way for people to see the same fault I am experiencing if Full Friendly URLs are enabled.
  12. mrGTB

    mrGTB Well-Known Member

    True, if not using Friendly URL's it matters not.

    Very odd one then
  13. Chris D

    Chris D XenForo Developer Staff Member

    I know :(

    I am all out of ideas.

    Thank you for replying by the way.

    Hopefully I'll crack it soon :D
  14. mrGTB

    mrGTB Well-Known Member

    Most likely won't work, as most server host don't require you to use RewriteBase. You may even have tried this already. But it may be worth changing this line below, you never know.

    #RewriteBase /xenforo
    To this with hash removed and XenForo part: This is going of the forum being installed in ROOT.

    RewriteBase /
    If community was installed in a sub-folder called "Forum", you'd use this instead (with .htaccess file located inside the forum folder, not the root):

    RewriteBase /forum/
    That's the last thing I can think.
  15. Chris D

    Chris D XenForo Developer Staff Member

    Yes have unfortunately tried that (and again just now) and it is the same.

    Everything is installed in the root, so no forum folder.
  16. Weppa333

    Weppa333 Active Member

    Hi Chris,

    I'm very interested in this bug as I have the same.
    /index -> / -> index, redirect loop

    I don't have xenporta currently installed BUT I did install it, then unsinstall + remove the files.

    So this might be a case of xenporta killing my XF install...

    Did you solve it ?
  17. Chris D

    Chris D XenForo Developer Staff Member

    Do you have @Jake Bunce's Route Changer installed?

    It could be that.

    Also, I think my actual problem -- jesus was this over a year ago? :LOL: -- was that we had some dodgy vBulletin redirection script in place that was redirecting in a loop - I can't remember specifics.

    If this post hasn't helped, I would probably suggest creating a new thread detailing your problem from the beginning (sometimes that's more useful, as this seems like a different issue).
  18. Weppa333

    Weppa333 Active Member

    yes I have route changer installed and running,
    I'll try disabling it, and let you know
  19. Weppa333

    Weppa333 Active Member

    disabling route changer does not help

    however, completely clearing the browser ( cahce, cookies, history ) solves it

    It seems either to be
    - a cookie problem
    - the browser cache "caching" a 301 redirect it shouldn't

    It's a "core XF" problem for sure. It is difficult to reproduce as solving the problem involves clearing the proofs :(
  20. Weppa333

    Weppa333 Active Member

    byt the way, the site affected by the redirect loop is (ht)password protected. was yours too ?

    I only have the issue with mobile products (android chrome or apple iphone) but I think this is irrelevant.

Share This Page