Notice: session_start(): Ignoring session_start() because a session is already active in /home/khurshed/public_html/post-seo.php on line 32


SEO : Website Speed up using Caching & Custom 404 Error Page Setting by .htaccess file

Published on 2020-12-19 04:05:59

image
Description :

1. Caching :

      Caching is the temporary storage for copies of files or data to deliver them too rapidly when they are requested. We can optimize Javascript, CSS, HTML, Image files, etc before any update to reduce the loading time of Webpages into the browser.


Web browsers cache HTML files, JavaScript, CSS, images to speed up the website which is a vital factor for Search Engine Optimization (SEO).

2. 404 Error Not Found

     A 404 Error message is an HTTP status code giving the information to the user that the server was unable to find the requested website/webpage.
HTTP " 404 Not Found " client error reply code indicates that the client's requested web page does not exist on the server.


A 404 status code does not indicate whether the resource is temporarily or permanently missing. Customize 404 page is more helpful to the visitor and provides information on what to do next. The main aim of a 404 page is to convert a likely negative experience into a positive sense.

3.  .htaccess File

      On the Apache web server, the .htaccess file allows the website owner to make changes to the website configuration without having to edit server configuration files. It is placed in the root directory of the website and the most common use includes redirecting web pages, setting custom error pages, like 404 pages, forcing the website to use HTTPS instead of HTTP, non-www to www redirection & generating 500 Internal Server Errors. It also controls caching between the browser and the Apache webserver.

  Editing or creating a .htaccess file

  1. log in to cPanel.

  2. Click on File Manager under the Files section.

  3. Click on the public_html /root folder for the site.

  4. Click on Settings & select Show Hidden Files & save (if not )

  5. Right-click on the .htaccess file and select Edit.

 If the .htaccess file does not exist, create a file

  1. Under the public_html folder click on the 'file' placed in the left top corner.

  2. Enter new file name as .htaccess

  3. Press Create New File


  # Setup Caching in .htaccess file


      ## CACHING START ##


     # 20 DAYS Cache


       <filesMatch ".(ico|jpg|jpeg|xml|png|pdf|gif|svg|swf|mov|mp4|js|css)$">


        Header set Cache-Control "max-age=1728000, public"


       </filesMatch>


     # 2 DAYS Cache


      <FilesMatch ".(php|txt|html|htm)$">


       Header set Cache-Control "max-age=172800, must-revalidate"


      </FilesMatch>


     ## CACHING Finish ##


    # Setup Custom 404 Error Page in .htaccess


          ErrorDocument 404 /404.php or 404.html

Commment






IP OK



Warning: Undefined variable $numberOfRows in /home/khurshed/public_html/post-seo.php on line 180

Warning: Trying to access array offset on value of type null in /home/khurshed/public_html/post-seo.php on line 180