Log In · Register

 
.htaccess brain fart
fixtatik
post Sep 26 2009, 08:17 PM
Post #1


Senior Member
******

Group: Member
Posts: 1,237
Joined: May 2008
Member No: 648,123



I must have hit my head or something, because I can't figure this out for the life of me. I've been doing some work on my site, and I realized if someone goes to site.com/folder/ and the folder doesn't exist, then I get a 404 error. I'd rather have Apache strip the slash at the end and just return site.com/folder, which is a page.

Right now I have:
CODE
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

...which is doing a grand job of rewriting everything I want rewritten, except for folders that don't exist.

Regex masters, any ideas?
 
 
Start new topic
Replies
mipadi
post Sep 26 2009, 09:29 PM
Post #2


Senior Member
******

Group: Administrator
Posts: 2,648
Joined: Apr 2008
Member No: 639,265



Completely a guess, but I think you want the last line to be

CODE
RewriteRule (.*) index.php [L]


The '*' means "zero or more characters", where as a '.' just means any one character (assuming Apache's regexps are the same as in other regexp libraries).
 

Posts in this topic
fixtatik   .htaccess brain fart   Sep 26 2009, 08:17 PM
mipadi   Completely a guess, but I think you want the last ...   Sep 26 2009, 09:29 PM
fixtatik   Nope, nothin' doin'. :\ I figured I...   Sep 26 2009, 11:00 PM


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: