mod_rewrite and clean urls

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

mod_rewrite and clean urls

Post 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 :(
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post 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...
Post Reply