If a person visits: http://domain.com, I want to redirect him to http://www.domain.com and if a person visits: http://domain.com/remove.php, I would like to redirect him to http://www.domain.com/remove
So basically, I want to add a www in the beginning of the url if a subdomain is not being requested and I also want the user to be redirected to a URL without the PHP extension in case he tries to access one. I know, how to accept pages which don't have .php extension but now I'm looking to a code for all the above features along with a redirection code which will redirect the user to a non PHP extension page in case he tries to visit one with the PHP extension
So, if he visits, he reaches ...
- http://www.domain.com/index.php http://www.domain.com/index
- http://domain.com/index.php http://www.domain.com/index
- http://domain.com/ http://www.domain.com