Question

I have a simple rewrite that changes

http://website.com/page.php?id=1

into

http://website.com/page/1

using the following rewrite

RewriteRule ^page/(\d+)/?$ /page.php?id=$1 [L]

The rewrite works, it displays the page (i don't get a 404), but it doesn't appear to be passing through the id from the URL.

To test this I basically echoed the $_GET['id'] and nothing was returned.

Does anyone know why I might be going wrong?

Many thanks

Was it helpful?

Solution

This is most likely due to enabling of MultiViews which runs before mod_rewrite and rewrites /page to /page.php.

Add this line on top of your .htaccess to disable it:

Options -MultiViews
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top