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
fixtatik
post Sep 26 2009, 11:00 PM
Post #2


Senior Member
******

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



Nope, nothin' doin'. :\
I figured I'd be able to drop a 301 redirect in there to send non-existant folders to the index.php page without the slash, but that didn't work either.

Go figure, I managed to get it to do what I want by putting a 301 redirect in PHP, but I hate not having URL rules away from the .htaccess file. That, and it would probably be faster going through Apache than the check I currently have in PHP.
 

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: