简体   繁体   中英

IIS: PHP - Can I have different 404 page for each directory in my html website?

I am creating an HTML website which has many sub directories. I want to have different 404 page for each directory.

Basically what I am trying to do is to, create a index.php file in each directory and treat that as 404 page. This page will request the url and check the requested file name and return the content accordingly.

Or you could just make an .htaccess file with:

ErrorDocument 404 404.html

Note there is no backslash before the 404.html - so now it will always look in the current directory for the error page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM