httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noah <s...@onastick.net>
Subject Re: [users@httpd] Rewriting all URLs to /index.php
Date Thu, 31 Mar 2005 11:13:20 GMT
On Thu, Mar 31, 2005 at 10:45:35AM +0400, Denis Gerasimov wrote:

> > If I'm understand you correctly, something like this:
> > 
> > RewriteEngine on
> > RewriteMap unescape int:unescape
> > RewriteRule ^/news/([^/]+)/([0-9]+)\.html$ \
> >     /index.php?url=${unescape:/news/$1.html}&id=$2 [L,QSA]
> 
[snip]
> 
> The thing is that requested URL, say /demo/test1.html, is internally mapped
> to appropriate file containing PHP class, php/demo/test1.class.php in that
> case. However, I want to have user-friendly URLs like /news/details/123.html
> that should be mapped to php/news/details.class.php, not
> /news/details/123.class.php

Which is completely different than your last post. =)

So, something like this:

RewriteEngine on
#
# place 'news' in $1, 'details' in $2, and the name of the file in $3
RewriteRule ^/([^/]+)/([^/]+)/(.*)\.html /php/$1/$2.class.php?id=$3 [L,QSA]

The assumption here is that the incoming URLs will be in the form:

/dir/dir/file.html

If your URLs can be in other formats, other regexes can be developed to
handle those cases; you may need multiple RewriteRule lines to handle
them, depending on how your layout.

--n

-- 
<huey> dd of=/dev/fd0 if=/dev/flippy bs=1024
<huey> ^^^ Making Flippy Floppy


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message