Joe Terranova on 14 May 2008 13:37:42 -0700

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

Re: [PLUG] regex question

On Tue, May 13, 2008 at 7:11 PM, John Sladek <> wrote:
> I'm trying to detect a url like this
> but not this
> I'll then be rewriting from
> to

You probably want to do something like this. This is what I do for my
wordpress, and I just changed theRewriteRule line for your purposes.
Basically, it checks to see if the url exists as a file or a
directory; if not, it takes everything after the / and puts it in the
format you wanted.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /public.php?page=$1 [L]

Let me know if you need anything else with this.

Joe Terranova
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --