21286 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 486 Views |
-
Silverstripe trailing slashes breaks login

2 June 2011 at 6:16am
Hi, I've been asked to updated the .htaccess file on a website to always add trailing slashes onto the URLs, e.g.
"www.xyz.co.uk/news" -> "www.xyz.co.uk/news/"I added this code to my htaccess file on the apache web server:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.xyz.co.uk/$1/ [L,R=301]This is working really well, except that with these rules, when I attempt to login to Silverstripe "www.xyz.com/admin", when I input my (correct) user name & password, Silverstripe responds with "That doesn't seem to be the right e-mail address or password. Please try again".
I am having trouble identifying where the login is getting disrupted. I would be grateful for any advice on an additional rule/tweak that would allow the admin login to function correctly.
Regards,
AndyH. -
Re: Silverstripe trailing slashes breaks login

2 June 2011 at 8:36am
Your RewriteRule will include POST requests, so submitting the login form to /Security/LoginForm will get redirected to /Security/LoginForm/ and turned into a GET. You should add a condition to your rule so that it excludes POST requests.
-
Re: Silverstripe trailing slashes breaks login

3 June 2011 at 4:04am
Ahh, I see. Thank you, I understand the logic of the login process better now.
For other peoples reference, these are the updated htaccess rules:
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.xyz.co.uk/$1/ [L,R=301]Thanks.
| 486 Views | ||
|
Page:
1
|
Go to Top |

