链接
步骤1:
网站web根目录下创建对应错误页面:
custom_404.html
custom_404.html
custom_50x.html
custom_50x.html
custom_50x.html
步骤2:
文件路径:/etc/apache2/sites-available/willless.com.conf
步骤3:
添加内容:
ErrorDocument 404 /custom_404.html ErrorDocument 500 /custom_404.html ErrorDocument 502 /custom_50x.html ErrorDocument 503 /custom_50x.html ErrorDocument 504 /custom_50x.html <Files "custom_404.html"> <If "-z %{ENV:REDIRECT_STATUS}"> RedirectMatch 404 ^/custom_404.html$ </If> </Files> <Files "custom_50x.html"> <If "-z %{ENV:REDIRECT_STATUS}"> RedirectMatch 404 ^/custom_50x.html$ </If> </Files>
步骤4:
重启apach2服务器:
sudo service apache2 restart
步骤5:
完成