Jump to content

400 Bad Request error?


cabofixe

Recommended Posts

Hey all,

 

So I feel like what I want to do isn't too hard.  I'm making a simple cms program and I want EVERY URI to be parsed through the controller.

 

My .htaccess file looks like this:

 

Options +FollowSymlinks

RewriteEngine on

RewriteRule . control.php [L]

 

It works well for almost everything. You can try it at: http://lawfirmsites.com/clondon/ or http://lawfirmsites.com/clondon/index or http://lawfirmsites.com/clondon/test.  If you type something that doesn't exist it defaults to index.  Later I'll make it go to an error controller.

 

It all works perfectly except for one url: http://lawfirmsites.com/clondon (Note the lack of a trailing slash). It gives me a 400 Bad Request error. Anybody know how I can correct this? Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/147065-400-bad-request-error/
Share on other sites

Try changing the rewrite rule to:

 

 

RewriteRule .* control.php [L]

 

 

(By the way, if someone ever went to control.php, it would create an infinite loop since control.php would be redirected to control.php which would be redirected to control.php so on....)

 

 

What directory is your htaccess file in?  If it's in /clondon/ that might be what's causing the problem.  I'm not sure why, but Apache might not parse the file right in /clondon/ if you go to /clondon.  (Technically /clondon could be a file since there is no trailing slash, but Apache should automatically add the trailing slash if the file doesn't exist.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.