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

The rewrite rule is backwards for your situation. This will (internally) rewrite the URL http://localhost/index/11/ into http://localhost/index.html?id=11. If the end user visits the latter URL directly, the rewrite rule won't apply. If you want to change http://localhost/index.html?id=11 into http://localhost/index/11/, you have to reverse the rewrite rule. However, you'll have to break out the query string into a RewriteCond directive, as the RewriteRule directive does not include the query string. Something like this (I can't remember the exact syntax for query string checking off the top of my head, so this might be a little off).

RewriteCond ${QUERY_STRING} ^id=([0-9]+)$
RewriteRule ^/index.html$ /index/%1/

--
Justin Pasher

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

Reply via email to