lundi 30 juillet 2018

htaccess GET friendly url instead of?

I have a problem with, i need to do so instead of i have to write "shop.php?id=0" i can write "shop/something", it works well BUT if i for example write "support/", then i goes to the shop php file, how can i remove this so support also can do like "support/something" and the shop also can be "shop/something"

I can write "support", then it works fine but when i want to do "support/something" it mess up, its when i just add a "/"

How can i fix this issue? (Ive made comments with // in the code, its not in the actual code, ive removed them there)

RewriteEngine On
//Do so instead of i write shop.php?id=0 i can do /shop/something
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*\.php$ shop.php [NC,L]



//Remove the .php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]



//404
ErrorDocument 404 /404.php




Aucun commentaire:

Enregistrer un commentaire