php.htaccessurlhttp-redirectionos

Trouble with htaccess dynamic redirects on IONOS


I am on a Apache server and have created a site with php using a MySQL database on IONOS.

I want to redirect the URLs from /page.php?id=xxx to /page/xxx

I have written a .htaccess file and uploaded it into the root folder. It worked fine until yesterday. I have looked all IONOS support pages and different websites, but I can't find what's the issue.

My htaccess file looks like this:

RewriteEngine On

RewriteBase /

RewriteRule ^page/(.*)$ page.php?id=$1 [QSA,L]

When I try to access the page with /page/xxx, it can't get the xxx id variable.


Solution

  • RewriteBase / is not required in DocumentRoot. Also, your RewriteRule appears to be reversed:

    RewriteRule ^page\.php?id=(.*)$ /page/$1 [QSA,L]