2011-01-13 183 views
2

如何更改默认网址。例如www.example.com/index.php - > www.example.com更改默认网址php

现在我想将它设置为www.example.com/test.php。我应该在php.ini中进行更改吗?

+0

这是在您的web服务器而不是在PHP中处理。你使用的是Apache还是别的? – 2011-01-13 22:22:13

回答

0

您将不得不在Apache的配置中使用DirectoryIndex指令更改此设置。

例如(在正确VirtualHost部分):

DirectoryIndex test.php 

虽然我不明白为什么地球上的人会想这样做......

1
DirectoryIndex test.php 

在你的.htaccess或httpd.conf文件

1

您可以设置htaccess的DirectoryIndex包括test.php的:

DirectoryIndex test.php index.php index.html 

呦ü还可以设置从index.php文件重定向:

header('Location: test.php'); //Must be before any content is sent out 

重定向将从htaccess的工作太:

Redirect 301 index.php test.php 

做最简单的事情,但是,这是重命名test.php的文件索引.PHP。为什么不这样做呢? :P