Change default url php
How to change the default开发者_高级运维 url. eg www.example.com/index.php -> www.example.com
now i want to set it to www.example.com/test.php. Should i make changes in php.ini?
Assuming you are using apache, you can do this through the DirectoryIndex
directive.
Check out the docs.
DirectoryIndex test.php
In your .htaccess or httpd.conf
You could set the htaccess DirectoryIndex
to include test.php:
DirectoryIndex test.php index.php index.html
You could also setup a redirect from index.php:
header('Location: test.php'); //Must be before any content is sent out
Redirects will work from htaccess too:
Redirect 301 index.php test.php
The simplest thing to do, however, would be renaming the test.php file to index.php. Why not just do that? :P
You would have to change this in Apache's configuration using the DirectoryIndex
directive.
e.g. (In the correct VirtualHost
section):
DirectoryIndex test.php
Although I can't see why on earth one would want to do that...
精彩评论