httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Mearns <mearn...@gmail.com>
Subject Re: [users@httpd] Problem with Mod_Rewrite
Date Tue, 14 Apr 2009 22:14:10 GMT
On Tue, Apr 14, 2009 at 3:32 PM, ricardo13 <ricardoogrande@gmail.com> wrote:
>
> Hi all,
>
> I have other doubt about mod_rewrite.
>
> Have this line in httpd.conf:
>
> RewriteEngine on
> RewriteRule ^/index/([0-9]+)/$ /index.html?id=$1
>
> When type "http://localhost/index.html?id=11" it doesn't show URL
> "http://localhost/index/11/"
> I saw this example in a site.
>
> What's happen ???
>
> Ricardo
> --

It looks like you're trying to do what's called "pretty URLS"; the
idea is to hide some ugly details about how your site actually works
(like passing query string values to a server side script) inside an
easier to remember and more natural looking URL. The being the case,
you would not generally want your users to enter
"http://localhost/index.html?id=11" as the URL, because that's not
very pretty. It's much nicer for a user to browse to
"http://localhost/index/11/" and have that handled correctly, which is
exactly how you have your RewriteRule set up. So it looks like your
rule is probably correct, you just misunderstood what it's used for.

-Brian

-- 
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://keys.gnupg.net

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