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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

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


Go to End


7 Posts   11113 Views

Avatar
lukeasrodgers

Community Member, 2 Posts

15 February 2008 at 7:17am

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

Google Summer of Code Hacker, 7 Posts

23 February 2008 at 3:36pm

Change:

RewriteCond %{REQUEST_URI} ^(.*)$

To:

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

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

Ofir

Avatar
kjello

Community Member, 7 Posts

25 August 2008 at 2:23pm

Edited: 25/08/2008 3:14pm

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

Kjo

Avatar
mikewheaton

Community Member, 9 Posts

12 October 2008 at 6:41am

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

Community Member, 1 Post

15 October 2008 at 3:37am

Edited: 15/10/2008 3:41am

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

Thanks!

Avatar
toopy

Community Member, 9 Posts

15 October 2008 at 9:14am

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

Community Member, 2 Posts

12 November 2008 at 7:01am

Edited: 12/11/2008 7:05am

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.