Better way to do search engine friendly URLs?

New to mod_rewrite? This is a good place to start.

Better way to do search engine friendly URLs?

Postby Atanos » Mon Sep 16, 2002 4:47 am

Hi,

currently I use a CMS that I've written myself. Basically, it just stores all data in a MySQL database and pulls the data from it using a simple PHP script. Now, the script looks messy depending on which page I wish to get from the database, for example:

index.php?lang=eng&page0=this&page1=that ....

Currently I use mod_rewrite to do this:

Code: Select all
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/site/(.*)
RewriteRule ^(.*) /index.php?lang=%1

RewriteCond %{REQUEST_URI} ^/site/(.*)/(.*)
RewriteRule ^(.*) /index.php?lang=%1&page0=%2

RewriteCond %{REQUEST_URI} ^/site/(.*)/(.*)/(.*)
RewriteRule ^(.*) /index.php?lang=%1&page0=%2&page1=%3


Just wondering if there's a better way to do this? Maybe something instead of having all these rewrite conditions, depending on the depth of the hierarchy.
Atanos
 

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 7 guests

cron