Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

getting 400 Bad Request error - probably a simple .htaccess problem


Reply

7 Posts   6376 Views

Avatar
lukeasrodgers

15 February 2008 at 7:17am Community Member, 2 Posts

I just installed silverstripe, and everything is working fine, but when I try to visit my site (e.g. http://www.mysite.ca/silverstripe) I get a 400 "bad request" error, unless I throw on the trailing slash (http://www.mysite.ca/silverstripe/).

I'm betting a simple change to the .htaccess file will resolve this, but I don't know what commands to enter. Any help would be most appreciated.

Avatar
Ofir Picazo

23 February 2008 at 3:36pm Google Summer of Code Hacker, 7 Posts

Change:

RewriteCond %{REQUEST_URI} ^(.*)$

To:

RewriteCond %{REQUEST_URI} ^(.*)/$

On line 7 of the .htaccess file. That should fix it.

Ofir

Avatar
kjello

25 August 2008 at 2:23pm (Last edited: 25 August 2008 3:14pm), Community Member, 7 Posts

almost fixed my problem. Almost. Login for admin still doesn't work.

Kjo

Avatar
mikewheaton

12 October 2008 at 6:41am Community Member, 9 Posts

I've got the same problem here. Adding the forward slash as described above only works for the home directory and breaks every sub-directory. Any suggestions?

Avatar
Rajesh

15 October 2008 at 3:37am (Last edited: 15 October 2008 3:41am), Community Member, 1 Post

I am also facing the same problem, any suggestion or fix will be helpful.

Thanks!

Avatar
toopy

15 October 2008 at 9:14am Community Member, 8 Posts

I had a similar problem on my local wamp-server.
May be you can try this in your .htaccess

...
### SILVERSTRIPE START ###
<IfModule mod_dir.c>
DirectorySlash On
</IfModule>
...
...
...

Avatar
jqtruong

12 November 2008 at 7:01am (Last edited: 12 November 2008 7:05am), Community Member, 2 Posts

Added two lines after RewriteBase:

### SILVERSTRIPE START ###
RewriteEngine On
RewriteBase /my/site

RewriteCond %{REQUEST_URI} site$
RewriteRule (.*) $1/ [L]

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
### SILVERSTRIPE END ###

Tested it lightly, seems to work ok, including accessing menus from the uri without the trailing slash, i.e. /my/site/admin and /my/site/admin/ both work.