I am not using a CMS or database - but I was curious if it is possible to have URLs like: www.domain.com/folder-name/page-name.php, and display them like: www.domain.com/folder-name/page-name
Is there a simple approach to achieving this?
I am not using a CMS or database - but I was curious if it is possible to have URLs like: www.domain.com/folder-name/page-name.php, and display them like: www.domain.com/folder-name/page-name
Is there a simple approach to achieving this?
This is actually easier than you would think. Just add the following code inside the .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
An added bonus is you can now link to documents in your code without using the .php file extension. Hope this helps!
edit out the .php in your HTML files/templates.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.