在localhost中的php中创建一个个性化的404错误页面

时间:2022-10-09 21:03:07

I want to create a personalized 404 error page in php , I want to it works in localhost, as you know the localhost does not have .htaccess file !

我想在php中创建一个个性化的404错误页面,我希望它在localhost中工作,因为你知道localhost没有.htaccess文件!

2 个解决方案

#1


2  

You can create a .htaccess file in your localhost. Simply make sure it is in the root directory of your web server (I believe in WAMP, it's the www folder). In XAMPP, it's the htdocs folder

您可以在localhost中创建.htaccess文件。只需确保它位于Web服务器的根目录中(我相信WAMP,它是www文件夹)。在XAMPP中,它是htdocs文件夹

#2


4  

You can create a .htaccess file in your localhost. Simply make sure it is in the root directory of your web server (I believe in WAMP, it's the www folder). In XAMPP, it's the htdocs folder

您可以在localhost中创建.htaccess文件。只需确保它位于Web服务器的根目录中(我相信WAMP,它是www文件夹)。在XAMPP中,它是htdocs文件夹

Then in your .htaccess file, you simply need something along the lines of:

然后在.htaccess文件中,您只需要以下内容:

ErrorDocument 404 /path/to/error/404/page

#1


2  

You can create a .htaccess file in your localhost. Simply make sure it is in the root directory of your web server (I believe in WAMP, it's the www folder). In XAMPP, it's the htdocs folder

您可以在localhost中创建.htaccess文件。只需确保它位于Web服务器的根目录中(我相信WAMP,它是www文件夹)。在XAMPP中,它是htdocs文件夹

#2


4  

You can create a .htaccess file in your localhost. Simply make sure it is in the root directory of your web server (I believe in WAMP, it's the www folder). In XAMPP, it's the htdocs folder

您可以在localhost中创建.htaccess文件。只需确保它位于Web服务器的根目录中(我相信WAMP,它是www文件夹)。在XAMPP中,它是htdocs文件夹

Then in your .htaccess file, you simply need something along the lines of:

然后在.htaccess文件中,您只需要以下内容:

ErrorDocument 404 /path/to/error/404/page