Re: RewriteRule REGEX ?
| From: | Daniel Pupius | Date: | Mon, 26 Jan 2004 11:24:13 +0000 |
| Subject: | Re: RewriteRule REGEX ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175742@lists.php.net to get a copy of this message | ||
I don't think you need to escape the full-stop (period) that could cause
problems. I've used the following rule with no problem:
RewriteRule ^learning/(.*).htm$ _rewriteHandler.php?query=$1/
"Monty" <monty3@hotmail.com> wrote in message
news:BC38131C.1F7FE%monty3@hotmail.com...
> My server runs Apache 2.0. I am trying to do a simple URL rewrite so that
> old URLs will map to our new style of URLS...
>
> From This: articles.php?id=999
> To This: articles/999
>
> In the .htaccess file for the htdocs folder that contains the web files, I
> put the following:
>
> RewriteEngine on
> RewriteRule ^articles\.php\?id=([0-9]+)$ articles/$1 [R]
>
> I've also tried this (no slash in front of ?):
>
> RewriteEngine on
> RewriteRule ^articles\.php?id=([0-9]+)$ articles/$1 [R]
>
> But I keep getting a 404 error for articles.php, which means that
something
> must be wrong with my RewriteRule because it's not matching. I've tried
> various tweaks and just can't get it to work.
>
> What am I doing wrong??
>
> Thanks.