Page 1 of 1

mod_rewrite and clean urls

Posted: Sat Jun 18, 2005 2:40 pm
by nickvd
I'd like to start to use mod_rewrite on my sites for the purpose of ridding my urls wtih ?page=blah&this=that uglyness...

I found a small rewrite rule that supposedly does this, but i just cannot get it to work...

Code: Select all

RewriteRule ^(.*)/?(.*)/?$ index.php?page=$1&sub=$2 їL,NC]

php їprint_r($_GET)] returns:

Array
(
    їpage] => index.php
    їsub] => 
)
Any ideas?!

btw, I am using this in a .htaccess, whenever I activate the rewrite rule, it stops my images/css from displaying.... this is causing me to pull all my hair out :(

Posted: Sat Jun 18, 2005 3:00 pm
by John Cartwright

Code: Select all

RewriteRule ^(.*)/(.*)$ /?index.php?page=$1&sub=$2 їL,NC]
http://localhost/home/subpage
Just write another rule to rewrite your images

Posted: Sat Jun 18, 2005 5:24 pm
by nickvd
That got me close, but it caused more problems...

Code: Select all

Array
(
    їpage] => index.php
    їsub] => 
)

Code: Select all

Array
(
    їpage] => gems/adsf
    їsub] => 
)
My images/styles still arent working. If i have to create rules for every single subdirectory, then what the hell is the point of doing things this way, it will just cause more work for all involved...