[geeks] .htaccess / mod_rewrite question

Phil Stracchino phil.stracchino at speakeasy.net
Sun Mar 5 17:24:40 CST 2006


Bill Bradford wrote:
> I've got the following .htaccess:
> 
> (someone else wrote it, I'm just the SOB who has to maintain it)
> 
> It apparently rewrites /url to /index.php?area=url 
> 
> RewriteEngine on
> Options FollowSymlinks
> RewriteBase /
> RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /index.php?area=$1&page=$2&mode=$3&value1=$4&value2=$5&value3=$6 [L]
> RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ index.php?area=$1&page=$2&mode=$3&value1=$4&value2=$5 [L]
> RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/$         index.php?area=$1&page=$2&mode=$3&value1=$4 [L]
> RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$                 index.php?area=$1&page=$2&mode=$3 [L]
> RewriteRule ^([^/]+)/([^/]+)/$                         index.php?area=$1&page=$2 [L]
> RewriteRule ^([^/]+)/$                                 index.php?area=$1 [L]
> 
> I need to be able to hit /stats directly (without any rewriting).
> 
> Tried adding this directly under RewriteBase:
> 
> RewriteRule ^stats/ [L]
> 
> but it didn't work
> 
> Any suggestions?

Off the top of my head, try this:


RewriteEngine on
Options FollowSymlinks
RewriteBase /
RewriteRule ^(stats/.*)$ $1 [L]
....


-- 
 Phil Stracchino       phil.stracchino at speakeasy.net
    Renaissance Man, Unix generalist, Perl hacker
 Mobile: 603-216-7037         Landline: 603-886-3518



More information about the geeks mailing list