开发者

Change default url php

开发者 https://www.devze.com 2023-02-04 11:40 出处:网络
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

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...

0

精彩评论

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