Re: .htaccess and PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 24, 2008 at 3:33 AM, Skip Evans <skip@xxxxxxxxxxxxxxxxx> 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
>
> http://varsitybeat.com/wi/madison/
>
> 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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux