You are here: Re: modrewrite (won't work for second rule) « All PHP « IT news, forums, messages
Re: modrewrite (won't work for second rule)

Posted by Janwillem Borleffs on 12/22/05 00:20

andrew.bistak@gmail.com wrote:
> RewriteEngine On
> RewriteBase /
> RewriteRule ^([^/]+)\.html$ pdisplay.php?page=p2/$1&type=htm
> RewriteRule ^([^/]+)\.html$ gdisplay.php?page=g2/$1&type=htm
>
> does anyone know why this rewrite won't work? It works for the first
> rule but not the second
>

Probably because the conditions for both rules are identical, so Apache
selects the first available match.

Something like the following would work better, where the pattern is altered
by modifying the file extension:

RewriteRule ^([^/]+)\.html$ pdisplay.php?page=p2/$1&type=html
RewriteRule ^([^/]+)\.htm$ gdisplay.php?page=g2/$1&type=htm

Another solution would be to use only the first one and have pdisplay.php
handle the redirect to gdisplay.php (when required).


JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация