Apache Server configuration support - Help with rewrite

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > August 2005 > Help with rewrite





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Help with rewrite
Michael Satterwhite

2005-08-28, 5:52 pm

I have two pages:
category.php?id=123
subcategory.php?id=456

I want to normalize them to cat123.html and subcat456.html (This isn't
carved in stone; if you can think of a better rewrite scheme, I'm open to
suggestions)

I've put the following into .htaccess:

RewriteEngine on
RewriteRule ^/cat(.+)\.html$ /category.php?id=$1
RewriteRule ^/subcat(.+)\.html$ /subcategory.php?id=$1

Would someone be so kind as to point out what I'm missing?

Thanks in advance
---Michael

Gabriel Reid

2005-08-28, 5:52 pm

Michael Satterwhite wrote:
> I have two pages:
> category.php?id=123
> subcategory.php?id=456
>
> I want to normalize them to cat123.html and subcat456.html (This isn't
> carved in stone; if you can think of a better rewrite scheme, I'm open to
> suggestions)
>
> I've put the following into .htaccess:
>
> RewriteEngine on
> RewriteRule ^/cat(.+)\.html$ /category.php?id=$1
> RewriteRule ^/subcat(.+)\.html$ /subcategory.php?id=$1
>
> Would someone be so kind as to point out what I'm missing?


It would be a lot easier to provide assistance if you would say what is
going wrong (i.e. what are you getting when you request the page, and
how does it differ from what you were expecting).

Your rewrite rules look okay to me, although I'd use "\d+" instead of
".+" for matching the id, assuming ids are always numeric.


Gabriel
Luigi Donatello Asero

2005-08-29, 7:50 am


"Gabriel Reid" <gabriel.reid@mail.to.gmail.dot.com> skrev i meddelandet
news:MnlQe.180551$gK7.10050680@phobos.telenet-ops.be...[vbcol=seagreen]
> Michael Satterwhite wrote:
to[vbcol=seagreen]


So, if I would like to redirect
https://www.scaiecat-spa-gigi.com/i...embre-2004.html
to
https://www.scaiecat-spa-gigi.com/i...tembre-2004.php

should I write
RewriteEngine on
RewriteRule ^/it/temperature-in-svezia-settembre-2004.html$
/it/svezia/.temperature-svezia-settembre-2004.php?id=$1
?


What is "id" for?


--
Luigi Donatello (un italiano che vive in Svezia)
(я ятальянец а я живу в Швеции )
( 我是 意大利人 , 但是 我 主 在 瑞典)
(minä olen Italian kansalainen, mutta minä asun Ruotsissa)
https://www.scaiecat-spa-gigi.com/i...tembre-2004.php



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com