Hi, this is driving me crazy so hope you can help. It seems quite simple.
Basically I have a simple site consisting of an index.php page that loads in the other pages using php switch case. This all works great. The trouble I'm having is cleaning the url with mod_rewrite
I'd like www.mysite.co.uk/index.php?id=page1&idimage=image1
to be rewritten as www.mysite.co.uk/page1/image1
I've tried using several mod_rewrite variations but nothing happens or I get error 500. The mod-rewrite is working fine when I did a test to remove "www". Can't figure this out! The .htaccess code I've tried is
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^/]*)$ /index.php?id=$1 [R]
RewriteRule ^([^/]*)/([^/]*)$ /index.php?id=$1&idimg=$2 [R]
And in my index.php I have the following PHP to read the converted url.
$data = explode("/",$HTTP_SERVER_VARS['PATH_INFO']);
$id = $data[1];
$idimage= $data[2];
I know people have asked about this before but I just can't get this working!! I've read loads of tutorials, but to no avail!
Please help! Before I throw my computer out the window!