Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Sir Osis of Liver on May 12, 2016, 01:43:22 AM

Title: Problem redirecting to subdirectory
Post by: Sir Osis of Liver on May 12, 2016, 01:43:22 AM
(http://www.thekrashsite.com/pics/hairpull1.gif)  Trying to redirect all variants of domain/subdirectory to subdirectory using .htaccess -



RewriteEngine On
RewriteRule ^$ /forum [L]




www.domain.com - works
domain.com - works
www.domain.com/forum - works
domain.com/forum - doesn't work in IE11

In IE11, login attempt results in SMF error 'You were unable to login. Please check your cookie settings.'  If second tab is opened, am logged into forum.  Login is normal in FF.  Also happens using php header redirect in account root. 

Any idea what's causing this?

Title: Re: Problem redirecting to subdirectory
Post by: qc on May 12, 2016, 01:52:17 AM
Is it about the "www" subdomain - or was that just an example and your real subdomain contains an underscore "_"? IE doesn't like that...

Edit: Probably rather related to this: http://stackoverflow.com/questions/15115917/ie10-sharing-cookies-across-subdomains-by-default
Title: Re: Problem redirecting to subdirectory
Post by: Sir Osis of Liver on May 12, 2016, 03:47:40 PM
It's not a subdomain, forum is installed in /forum subdirectory, only letters in url.  I'm redirecting all traffic to the domain (www.domain.com) to the subdirectory (www.domain.com/forum).  The redirect is successful in all cases, but domain.com/forum results in SMF cookie error in IE.  The login is actually successful, if I open another tab and go to the forum, I'm logged in.  It seems to be an SMF problem.

Title: Re: Problem redirecting to subdirectory
Post by: Arantor on May 12, 2016, 03:49:57 PM
Try turning on subdomain independent cookies.

SMF's idea of 'subdomain dependent' cookies also forces them to be bound to the relevant path in the domain too. If a browser chooses to do something odd with it, that's something else.

Though if you're redirecting from / to /forum why not just install it in / to begin with?
Title: Re: Problem redirecting to subdirectory
Post by: Sir Osis of Liver on May 12, 2016, 04:15:10 PM
Hmm, thought I had tried that, but it seems to have fixed it.  Both links without www. were causing login problem today, but all variants are working now.  IE works in mysterious ways.

Don't like to install forum in root in case owner decides to add something else to the account (website, blog, etc.).  It's a new setup, just the forum for now, but saves me the trouble of having to move at some later point.

Thx, Arantor.

Title: Re: Problem redirecting to subdirectory
Post by: Arantor on May 12, 2016, 04:54:21 PM
Glad to hear it.