Abdul Waheed Abdul Waheed - 1 year ago 79
PHP Question

Url rewriting to hide .html and .php from all project files

i have few pages i my project they are:


I want to show in url without.php or .html
i tried with this code:

RewriteEngine On
RewriteCond %{http://www.example.net/project name/index.php} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]

this is not working

Answer Source
RewriteEngine on
RewriteBase /
RewriteCond %{http://www.ameryprod.com/index.html} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://www.ameryprod.com/$1 [R=301,L]

Finally i found this solution hope it works for you as well.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download