Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The realization of 404 page replacement by configuring Apache is introduced in detail.

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

404 page replacement by configuring Apache

1. General situation--modify apache configuration.htaccess

The reason for the general website to report 404 is that the resource cannot be found, the server (Apache for example) reported an error, Apache customized the 404 output, our goal is to use the custom 404.html to replace the Apache output,

Then there is the following code and procedure:

For Apache servers: Create a 404 page, design your own page, name it notfind.php, and upload it to the root directory of the site. Open the.htaccess file, add the code: ErrorDocument 404/notfound.php (note: there is a space between 404 and/), and upload the.htaccess file to the root directory of the site. If ErrorDocument 404/index.php exists for.htaccess, be sure to delete it. This redirects the 404 error to the home page of the site, which in severe cases can cause the home page to disappear from search engines. END

Examples:

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !- d RewriteCond %{REQUEST_FILENAME} !- f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] ErrorDocument 404 /notfound.php

The above is through the configuration of Apache 404 page replacement detailed explanation, if you have questions please leave a message or to the site community exchange discussion, thank you for reading, hope to help you, thank you for your support of this site!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report