400 bad request when no trailing slash

New to mod_rewrite? This is a good place to start.

400 bad request when no trailing slash

Postby fris » Sat Oct 24, 2009 8:38 am

Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.+)$ view.php?f=$1 [QSA,L]


when i do domain.com/dir it gives 400 bad request, but domain.com/dir/ is fine.

I want it to ignore index.php and do view.php?f=filename for everything else, view.php shows source code for the file clicked in an open directory.
[/code]
fris
 
Posts: 52
Joined: Thu Feb 23, 2006 12:05 pm

Postby richardk » Sun Oct 25, 2009 11:01 am

What does your error log say about the error?
Does the URL in your browser's address bar change?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond $1 !^(index|view)\.php$
RewriteRule ^(.+)$ ./view.php?f=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 3 guests

cron