Re: Problem with Mod_Rewrite

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

 



You need to make sure that your html files are parsed by the php parser, find the line in http.conf and add .html (if this Is safe for your server)

Or

Simple chane the rewrite rule to read index.php?id= 

This is all assuming you have php code that uses $_GET['id'] to construct the page
Sent from my BlackBerry® wireless device

-----Original Message-----
From: Justin Pasher <justinp@xxxxxxxxxxxxxxxxxxx>

Date: Tue, 14 Apr 2009 15:03:51 
To: <users@xxxxxxxxxxxxxxxx>
Subject: Re:  Problem with Mod_Rewrite

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