Re: [users@httpd] Rewriting all URLs to /index.php

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

 



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@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