更改默认url php
如何更改默认url。例如www.example.com/index.php->www.example.com更改默认url php,php,httpd.conf,Php,Httpd.conf,如何更改默认url。例如www.example.com/index.php->www.example.com 现在我想将其设置为www.example.com/test.php。我应该在php.ini中进行更改吗?假设您使用的是apache,您可以通过DirectoryIndex指令进行更改 .您必须使用指令在Apache的配置中更改此设置 e、 g.(在正确的VirtualHost部分中): 虽然我不明白为什么有人会这么做 DirectoryIndex test.php 在.htaccess
现在我想将其设置为www.example.com/test.php。我应该在php.ini中进行更改吗?假设您使用的是apache,您可以通过
DirectoryIndex
指令进行更改
.您必须使用指令在Apache的配置中更改此设置 e、 g.(在正确的
VirtualHost
部分中):
虽然我不明白为什么有人会这么做
DirectoryIndex test.php
在.htaccess或httpd.conf中,可以将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文件重命名为index.php。为什么不这样做呢P这是在web服务器中而不是在PHP中处理的。您使用的是Apache还是其他什么?我想最简单的方法是创建一个链接。是的,我使用的是Apache。是否有配置文件?是的,它通常命名为
httpd.conf
Redirect 301 index.php test.php