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
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.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.