开发者

url rewriting and subdomains

开发者 https://www.devze.com 2023-03-12 07:45 出处:网络
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

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

DirectoryIndex page.php ...

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/example2 folder, 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 as DirectoryIndex page.php.

Then, that will ensure that it serves the php page. Hope I was clear! Read this!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号