I have a PHP website,
e.g. http://www.test.com/rewrite-test/s/z2SZhBL
This was previously on Apache which had a rewrite rule to trap the "z2SZhBL" using the $_GET['id']
.
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ /index.php?id=$1 [L]
I need to move this website onto IIS and I need to get the URL rewrite rule working. I have tried these examples.
So in the folder "rewrite-test" I have an index.php which is echoing out the $_GET
variables and there are no get variables coming back they are all empty.
I can get the variables using this workaround.
$params = explode( "/", $_SERVER['HTTP_X_ORIGINAL_URL'] );
print_r($params);
Is this best solution?
index.php?id=$1
so you can continue to use$_GET
. – Twisty