It possible to rewrite url of the form
http://website.com/page.php to http://page.website.com, and when I enter an url such as
http://page.website.com, it will treat it as http://website.com/page.php?
When I am on the page, can the address bar continue showing http://page.website.com ? How can I achieve all this?
You can change your default directory page to include “page.php”. In that case, it would be served if you requested the directory.
Add the following to the .htaccess’s DirectoryIndex line
Also refer to this.
EDIT:
Whichever pages you want the server to search for within the directory, when you try to request the folder, you specify them in order in the DirectoryIndex part of your .htaccess.
e.g.
If you have an index.html and a page.php, in the same
www.site.com/example/example2folder, apache serves the index.html by default. But you can override this behavior using the .htaccess file.If you want the server to serve the page.php when you request for
www.site.com/example/example2, put it in your .htaccess asDirectoryIndex page.php.Then, that will ensure that it serves the php page.
Hope I was clear! Read this!