How to hide php html extension and with redirect non www
In this tutorial we will discuss “how to hide php html extension and with redirect non www to www domain.”
What is .htaccess?
.htaccess is a configuration file for use on web servers running software i.e. the Apache Web Server. When a .htaccess file is put in a directory which is in turn ‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files can be used to amend the configuration of the Apache Web Server software, to enable/disable supplementary functionality and features that the Apache Web Server software has to provide. These facilities include basic redirect functionality, for example: if a 404 file not found error arises, or for more improved functions such as content password protection or image hotlink prevention.
The Apache module mod_rewrite permits you to rewrite URL requests that come into your server and is based on a regular-expression parser.A permanent 301 redirect in your .htaccess file lets search engines and others know that an old link has been replaced by a new one. It’s the adopted method for administering traffic from an existing page.
Options +FollowSymLinks -MultiViews
# To externally redirect /howtoistart/index.php to /howtoistart/index
## To internally redirect /howtoistart/index to /howtoistart/index.php
Redirect all files with certain extension
To re-direct all of one type of file to another, such as howtoistart.com/file.php to howtoistart.com/file.htm
Force non www. version of domain to be used
If you have a lot of links on the web where people are linking to your site as www.howtoistart.com, but you would like your visitors to instead end up at howtoistart.com you can force this version of your domain with these following rules:
Redirect an old domain to a new domain
If you had an old domain such as howtoistart.com, and now you assured you actually want to use howtoistart.net for your website. You could setup a 301 redirect for the entire domain, so that old links to howtoistart.com carry over.
Force www. version of domain to be used
A search engine like Google would see howtoistart.com and www.howtoistart.com as essentially two unrelated websites. They endorsed you pick one version you’d like search engines to display and using a 301 redirect is a possible alternative.
If you have a lot of links on the web where people are linking to your site as howtoistart.com, but you would like your visitors to instead end up at www.howtoistart.com you can force this version of your domain with these rules: