I want to make something like:
www.example.com/var1/var2/
where I can take the value of the variables, but it also need to be compatible with GET
like:
www.example.com/var1/var2/?feat=1234
How can I do this?
Thanks
I want to make something like:
www.example.com/var1/var2/
where I can take the value of the variables, but it also need to be compatible with GET
like:
www.example.com/var1/var2/?feat=1234
How can I do this?
Thanks
<?php
$url = $_SERVER['REQUEST_URI'];
$url_splitter = explode('/', $url);
echo '<pre>';
print_r($url_splitter);
?>
Now you can access the variables by taking $url_splitter[0]
, $url_splitter[1]
,....
Check out symfony or codeigniter
The documentation will explain how to do a mod rewrite to get the url you want.
A partial re write can be done in this way (have not tested)
http://forums.devshed.com/apache-development-15/partial-mod-rewrite-454669.html
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?var1=$1&var2=$2 [QSA,L]
That should turn a url like /foo/bar/?var3=baz
into /index.php?var1=foo&var2=bar&var3=baz
I am not sure it'll work though because I don't know how the regexp in the mod rewrite works.