Forum Moderators: phranque

Message Too Old, No Replies

url rewriting and expode() in php

         

cyberlahy

6:12 pm on Nov 18, 2007 (gmt 0)

10+ Year Member



Hello,

What is faster :
1) 3 RewriteCond and RewriteRule like

RewriteCond %{REQUEST_URI}!^/show\.php
RewriteCond %{HTTP_HOST}!^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^blog/([^.]+)$ /show.php?member=%1&section=blog&link=$1 [L]

and after in PHP
$page = explode( '/', $_GET['link'] );
switch( $page[0] ) {
case ...;
}

or

2) 25 RewriteCond and RewriteRule of all possibilities (blog, mail, photos, ...) :

RewriteCond %{REQUEST_URI}!^/show\.php
RewriteCond %{HTTP_HOST}!^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^blog/category/([0-9]+)/$ /show.php?member=%1&section=blog&category=$1 [L]

RewriteCond %{REQUEST_URI}!^/show\.php
RewriteCond %{HTTP_HOST}!^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^blog/category/([0-9]+)/post/([0-9]+)/$ /show.php?member=%1&section=blog&category=$1&post=$2 [L]

...

RewriteCond %{REQUEST_URI}!^/show\.php
RewriteCond %{HTTP_HOST}!^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^photo/gallery/([0-9]+)/$ /show.php?member=%1&section=photo&gallery=$1 [L]

...

Thanks!