Use .htaccess to Access Your Pages Without Using an Extension
Use .htaccess to Access Your Pages Without Using an Extention
This example allows you to view pages without including the extension. For example, you might have a page named services.php; With this method, you can now access the page via /contact, without the .php extension.
In your .htaccess file, within the folder of your pages, add the following:
RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d #allows showing path with no extention, e.g. domain.com/services -> services.php RewriteRule ^([^.]+)$ $1.php [NC,L] #allows showing path with html extension to serve a php file, e.g. domain.com/services.html shows services.php RewriteRule ^(.*)\.html$ $1.php