I am trying to remove ?id= from the url and replace ?id= with a slash (/).
I want to show the address:
https://localhost/Test/Change.php?id=sd32sdas93ks93kf.553sa
As:
https://localhost/Test/Change/sd32sdas93ks93kf.553sa
I have managed to delete the .php
from the URL, but I have still issues with ?id=
The original link with ?id=
accessible. When I navigate to the page without ?id=
I get:
The requested URL Test/Change/sd32sdas93ks93kf.553sa.php
was not found on this Server`.
Does someone know how I can fix this?
Here is my .htaccess:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+Change(?:\.php)?\?id=([a-z\-_0-9]+)/([^/.]+) [NC]
RewriteRule ^Change/%1? [R,L]
RewriteRule ^Change/([a-z\-_0-9]+)/([^/.]+)/?$ Change.php?id=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]