How to remove error in react js, Apache Server

How to remove error in react js, Apache Server

Some details of 404 requested URL not found

The 404 error are the famous types of error in server side. This blog are helpful for these types of issue when it come for server side. The HTTP error 404, means the page are could not found which user are trying to open on this server. That’s the actually reason was either page has been deleted or moved and the URL has not been modified accordingly, or that you have misspelled the URL.

The way is how to remove 404 Url not found issue in react js deployment, Apache Server…

Please follow steps below in points…..

1. /etc/apache2/sites-available :
2. Open File 000-default :
3. Change its permission 777 : 
4. Paste code on bottom of file : 

RewriteEngine on # Don't rewrite files or directories RewriteCond %REQUEST_FILENAME} -f [OR] RewriteCond %REQUEST_FILENAME} -d RewriteRule ^ - [L] # Rewrite everything else to index.html to allow html5 state links RewriteRule ^ index.html [L]

5. File look like :

  <VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must aear in the request’s Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    # ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoow/html

   # Available loglevels: trace8, …, trace1, debug, info, noticrn,
   # error, crit, alert, emerg.
   # It is also possible to configure the loglevel for particular
  dules, e.g.
   # LogLevel info ssl:warn

ErrorLog ${APACHELOG_DIR}/errorlog
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with “a2disconf”.
  # Include conf-available/serve-cgi-bin.conf
</VirtualHost>

  # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

RewriteEngine on # Don't rewrite fils or directories RewriteCond %{REQUEST_ILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] # Rewrite everything else to index.html to allow html5 stats RewriteRule x.html

6. Restart server by these commands : 

sudo /etc/init.d/apache2 restart or sudo service apache2 restart

Leave A Comment

Your email address will not be published. Required fields are marked *