You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by bearsfoot <ad...@gmail.com> on 2009/11/24 03:23:41 UTC

[users@httpd] More RewriteRule issues ..

Hi,

I have the following rules in my .htaccess.

RewriteRule products/(.*)/ /index.php?view=products&brand=$1 [L]
RewriteRule products/(.*)/(.*)/ /index.php?view=productdetail&brand=$1&id=$2
[L]

These are the urls the users see:
http://www.mysite.com/products/product-name/ 
http://www.mysite.com/products/product-name/1/ 

These are the pages the users see:
http://www.mysite.com/index.php?view=products&brand=product-name
http://www.mysite.com/index.php?view=productdetail&brand=product-name&id=1


I want to add another rule rewrites the folowing url. 
http://www.mysite.com/products/product-name/?filter=10

to

http://www.mysite.com/index.php?view=products&brand=product-name&filter=10

Can someone please show me how to implement this rule without interferring
with the existing second rule  ?

Thanks,
Adam


-- 
View this message in context: http://old.nabble.com/More-RewriteRule-issues-..-tp26489575p26489575.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


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


Re: [users@httpd] More RewriteRule issues ..

Posted by Jonathan Zuckerman <j....@gmail.com>.
On Tue, Nov 24, 2009 at 12:38 AM, Boyle Owen <Ow...@six-group.com> wrote:
>> -----Original Message-----
>> From: bearsfoot [mailto:adam.p.reynolds@gmail.com]
>> Sent: Tuesday, November 24, 2009 3:24 AM
>> To: users@httpd.apache.org
>> Subject: [users@httpd] More RewriteRule issues ..
>>
>>
>> Hi,
>>
>> I have the following rules in my .htaccess.
>>
>> RewriteRule products/(.*)/ /index.php?view=products&brand=$1 [L]
>> RewriteRule products/(.*)/(.*)/
>> /index.php?view=productdetail&brand=$1&id=$2
>> [L]
>>
>> These are the urls the users see:
>> http://www.mysite.com/products/product-name/
>> http://www.mysite.com/products/product-name/1/
>>
>> These are the pages the users see:
>> http://www.mysite.com/index.php?view=products&brand=product-name
>> http://www.mysite.com/index.php?view=productdetail&brand=produ
> ct-name&id=1
>>
>>
>> I want to add another rule rewrites the folowing url.
>> http://www.mysite.com/products/product-name/?filter=10
>>
>> to
>>
>> http://www.mysite.com/index.php?view=products&brand=product-na
> me&filter=10
>>
>> Can someone please show me how to implement this rule without
>> interferring
>> with the existing second rule  ?
>
> What did you try yourself already? What results did you get? What
> problems did you encounter?
>
> Rgds,
> Owen Boyle
> Disclaimer: Any disclaimer attached to this message may be ignored.
>
> Hint: A query-string is NOT part of the URL and so is not immediately
> visible to a RewriteRule. For further details, check out:
> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule (and
> read the grey box "what is matched?")
> http://wiki.apache.org/httpd/RewriteQueryString
>
>
>>
>> Thanks,
>> Adam
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/More-RewriteRule-issues-..-tp26489575p26
> 489575.html
>> Sent from the Apache HTTP Server - Users mailing list archive
>> at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>
> This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message.
> The sender's company reserves the right to monitor all e-mail communications through their networks.
>
> ---------------------------------------------------------------------
> 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
>
>

This is an end-user to end-user help list for the Apache webserver, if
the listserv description was accurate, we would help you get
mod_rewrite *installed* and stop right there.  It sounds like what you
really are asking for help with is regular expressions - which we're
all happy to help with, but we'll need a little bit more info and some
re-assurance that you're going far enough by reading the manual and
trying to help yourself.

Specifically addressing your problem, I think you're interested in the
flag "QSA" (query-string all).  Check it out in the link that Owen
directed you to, or this site which has a nicely condensed version:
http://www.addedbytes.com/apache/mod_rewrite-cheat-sheet/

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


RE: [users@httpd] More RewriteRule issues ..

Posted by Boyle Owen <Ow...@six-group.com>.
> -----Original Message-----
> From: bearsfoot [mailto:adam.p.reynolds@gmail.com] 
> Sent: Tuesday, November 24, 2009 3:24 AM
> To: users@httpd.apache.org
> Subject: [users@httpd] More RewriteRule issues ..
> 
> 
> Hi,
> 
> I have the following rules in my .htaccess.
> 
> RewriteRule products/(.*)/ /index.php?view=products&brand=$1 [L]
> RewriteRule products/(.*)/(.*)/ 
> /index.php?view=productdetail&brand=$1&id=$2
> [L]
> 
> These are the urls the users see:
> http://www.mysite.com/products/product-name/ 
> http://www.mysite.com/products/product-name/1/ 
> 
> These are the pages the users see:
> http://www.mysite.com/index.php?view=products&brand=product-name
> http://www.mysite.com/index.php?view=productdetail&brand=produ
ct-name&id=1
> 
> 
> I want to add another rule rewrites the folowing url. 
> http://www.mysite.com/products/product-name/?filter=10
> 
> to
> 
> http://www.mysite.com/index.php?view=products&brand=product-na
me&filter=10
> 
> Can someone please show me how to implement this rule without 
> interferring
> with the existing second rule  ?

What did you try yourself already? What results did you get? What
problems did you encounter?

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

Hint: A query-string is NOT part of the URL and so is not immediately
visible to a RewriteRule. For further details, check out:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule (and
read the grey box "what is matched?")
http://wiki.apache.org/httpd/RewriteQueryString


> 
> Thanks,
> Adam
> 
> 
> -- 
> View this message in context: 
> http://old.nabble.com/More-RewriteRule-issues-..-tp26489575p26
489575.html
> Sent from the Apache HTTP Server - Users mailing list archive 
> at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. 
The sender's company reserves the right to monitor all e-mail communications through their networks.

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