Search for the Article

How to resolve the Server error! server encountered an internal error and was unable to complete your request

I was trying to move my entire live site from live server to local server. After moving my entire site content and database to local server and editing in web configure file, when I tried access my site from a local computer , I got a server error like

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.

Error 500

localhost
Apache/2.4.34 (Win32) OpenSSL/1.0.2o PHP/5.6.38


server encountered an internal error and was unable to complete your request
Server Error Snapshot


I go through many WP forums and blogs to find the solution, none of them seems to resolve this error until I found a simple solution by making some small changes in .htaccess file.

What is .HTACCESS File.

.htaccess “Hypertext Access”, is a server configuration file read by the server. It contains various rules that gives your website’s server many instructions. The instructions are like..
  • Set a Website Preferred Version (like whether your site opens with www or without www
  • Page Redirection(301 (Permanent Redirect) and 302 (Temporary Redirect) implementation)
  • URL rewriting.
  • Custom error page setup (404 Error Page Redirection)
  • Password protected folders 
  • Controlling user access

How to Resolve this Server Issue?

1.  Locate the .htaccess file and open it in Notepad or any other editor.
2.  Find the below code and add a (#) hash tag before each line.
  
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
  ExpiresActive On
  ExpiresDefault A2592000
</FilesMatch> 
  

3.  After making it comment the .htaccess code will look like this.



Remember: You can solve this issue by deleting the .htaccess file. it will work, but deleting a file from server encounte many more other problems. So, I would advise to keep it in a separate place,so that after making changes on local server we could upload it later on live server.

If you find any other better option, without editing or deleting the .htaccces file from site, please share your thoughts with me on virendersinghlostu@gmail.com.