I have this .htaccess
file and I have no knowledge with mod_rewrite,
JavaScript
x
RewriteEngine On
RewriteRule ^(.+[^/])/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{THE_REQUEST} s/([^.]+).php [NC]
RewriteRule ^ /%1 [NE,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)/?$ /$1.php [L]
What I want to achieve is to have localhost/viewticket/${id}
instead of localhost/viewticket.php?id=123
I have tried many .htaccess
rules but none worked except this one that hides .php
in my URL.
Advertisement
Answer
I created this one for you, just erase yours and copy this one enjoy^^
JavaScript
IndexIgnore */*
Options FollowSymLinks
AddDefaultCharset utf-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^viewticket/([^/]+)/?([^/]*)/?([^/]*)$ viewticket.php?id=$1¶m2=$2¶m3=$3 [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)/?$ /$1.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php [L]
</IfModule>```