1

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]
Brad
  • 159,648
  • 54
  • 349
  • 530
John
  • 904
  • 8
  • 22
  • 56
  • Possible duplicate of [Remove .php and id from url and replace with slash](https://stackoverflow.com/questions/20738855/remove-php-and-id-from-url-and-replace-with-slash) – P. Dev Apr 25 '19 at 23:52
  • 1
    @P.Dev Why do you think my question is a duplicate? I am using the 'same code'. In my case the code is not working. – John Apr 26 '19 at 00:05
  • Rewrite log, END flag, and perhaps some reading of https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained – mario Apr 26 '19 at 01:22
  • In the article I see the same thing. It is still not clear what I am doing wrong and why my script is not working – John Apr 26 '19 at 21:17

0 Answers0