简体   繁体   中英

Create error pages and modify htaccess?

Iam trying to create error pages for my website, I created an file with the following code: 文件:

ErrorDocument 403 /403.htm `

ErrorDocument 404 /404.htm

I also created the html files, I uploaded it in the root directory but it doesn't work.

Coould anyone tell me if I am doing anything wrong?

Thanks in advance

Blockquote

First, I would try something like adding this directive, and testing a 404 to see if it works:

ErrorDocument 404 "Sorry, no file here"

If you don't get that error, then in all likelihood your .htaccess file isn't being processed. You need to make sure that it's enabled on your server, etc. It is also possible that your ErrorDocument directive is specified somewhere that it isn't being read for the context where you are testing.

If you do get that error, the next thing I would do is make sure that your error documents are where you think they are. You mention that you uploaded them to the root directory of your project, so I would try browsing to them and see what happens.

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