views:

64

answers:

2

So i have a mvc system setup but it does not generate search engine friendly urls.

A typical url is in the format:

http://sitedomain.com/class/classMethod?parameter=valueA?parameter2=valueB

This is what i need to have:

http://sitedomain.com/class/valueA/valueB/

My .htaccess actually modified a part of the url already but i dont know how to do the second part

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?controller=$1 [L,QSA]

(originally looked like http://site.com/index.php?controller=class, but after the htaccess below is ran, it looks like http://site.com/class)

If anyone could help me with this, that would be great, thank you.

A: 

I use the following .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$            rewrite.php?%{QUERY_STRING}

And extracting parts from the url is all done in PHP.
Parsing the $_SERVER['SCRIPT_NAME'] variable.

(I find php code much easer to debug than complex apache rewrite rules.)

Bob Fanger
1337holiday
A: 
RewriteRule ^/class/(.*)/(.*)/$ index.php?controller=class&parameter=$1&parameter2=$2 [L,QSA]
methodin
hmm but u see, i may or may not have parameters passed in, also there could be more than 2 parameters (not a defined number of them, since there will be different forms on the site). I think this is REALLY close to what i need.
1337holiday
Then add conditions for all the combinations of parameters you expect. Given that you cannot use a script to do these checks you don't have a ton of options.
methodin