httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt <>
Subject Re: [users@httpd] .htaccess and PHP
Date Thu, 24 Jul 2008 14:08:59 GMT
On Thu, Jul 24, 2008 at 3:33 AM, Skip Evans <> wrote:
> Hey Matt,
> (I just sent you the message off list, but now rereading this again, I'm
> starting to understand.)
> I see that I'm affecting all the URLs, including the ones the app is
> initiating and that's what's breaking stuff.
> But what if I want the rule to ONLY take affect when the URL ends with a '/'
> char, as in the case of
> That's the only time I need the rule to kick in, when they give me a city
> and school name on the URL, and this is also the only time a URL will end
>  with a '/'.
> What would you change on this one?
> Options +FollowSymlinks
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^([^/]+)/([^/]+) /index.php?st=$1&sc=$2 [NC]
> ...which seems closest yet, to only make it apply the URL to URL's ending in
> '/' ?
> Thanks,
> Skip

Actually, you can do that, and the server would do

/blah/blah doesnt match -> /blah/blah/ -> does match

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/$ /index.php?st=$1&sc=$2 [NC]

should do it

/$ means that the matched string must end ($) with a slash,

hope it works for you (I didnt get the off list message btw)

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message