Is it possible to configure Apache in order not to show a file extension?
For example: Say I have domain.com/page.php
but want to have domain.com/
There is also MultiViews
as a vhost or .htaccess configuration option. See http://httpd.apache.org/docs/2.2/content-negotiation.html#multiviews
From that page:
The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements.
Put this is your .htaccess file
#turn on url rewriting
RewriteEngine on
#remove the need for .php extention
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
This allows you to access .php files without the extension, so your links should read
href="/somepage"
and this will direct to
href="/somepage.php"
Put this is your .htaccess file
RewriteEngine On
RewriteRule ^page?$ page.php
<a href="page">page</a>
This is called URL rewriting. I had to use it for the first time recently and i used this tutorial to learn it, hope you'll find it great too :
You want a web server feature called URL rewriting - every web server application (apache, IIS, nginx) supports this. As the name suggests, it takes the requested URL and rewrites it into a specific format that you define.
There are many guides available on the www, even if you are using shared hosting solution you can still add/modify the .htaccess file to do this.