More URL PHP Variable Problems

Discuss practical ways rearrange URLs using mod_rewrite.

More URL PHP Variable Problems

Postby Simon H » Thu Oct 31, 2002 4:10 am

Hi all!

I'm new to this forum so please be kind.

I'm trying to do what most people are doing but with a few variations which I just can't make work:

I have the following URL which I want to change as illustrated but I also have directories like /images/ and /css/ that I need to work as normal.

From:
http://www.mydomain.com/category/page

To:
http://www.mydomain.com/index.php?cid=$1&id=$2

I also want to illustrate a hierarchy of categories to appear like directories:

From:
http://www.mydomain.com/category/sub_category/page

To:
http://www.mydomain.com/index.php?cid=$ ... d=$2&id=$3

and perhaps more sub directories.

I have tried the following and it seems to show the index.php but the variables don't work, and the images in /images/ dont show..I even tried aliases for these directories...

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9]*)/([a-zA-Z0-9]*)
RewriteRule ^(.*) index.php?cid=$1&id=$2 [L]

I hope someone can shed some light on this....it's doing my head in!

Thanks for the help!

Simon H
Simon H
 

Postby Guest » Sun Nov 03, 2002 11:37 am

Try...
Code: Select all
RewriteEngine On
RewriteRule ^/([a-zA-Z0-9]+)/([a-zA-Z0-9]+) /index.php?cid=$1&id=$2
Guest
 


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 22 guests

cron