Turn off the .htaccess on Apache


How Turn off the .htaccess on Apache – Not because there is a performance increase if we do not use .htaccess on Apache but the case that I experienced there is malware or security gaps that adds a redirect on the .htaccess file to a page on the site – site hosting in my VPS. Using VestaCP to control panel. These issues I will discuss more details at a later date. For first aid I did was turn off read .htaccess configuration support.


How do you do? Please edit your Apache virtual host configuration, for VestaCP there in/home/[name_user]/conf/web/apache2.conf. Then add the following code:

<Directory /> 
    AllowOverride none 

AllowOverride none code can only be used in the block Directory, and the program is placed in block VirtualHost.

After that restart Apache:

# service apache restart

If after that there is a link Error 404 Not Found means the code – the code rewrite URL yet you move to the previous Apache virtual host configuration. I demonstrated to WordPress:

<VirtualHost *:80> 
    ServerName name_domain.com
    ServerAlias name_domain.com www.name_domain.com
    DocumentRoot /home/name_user/web/name_domain/public_html/
Options -Indexes FollowSymLinks
<Directory /> 
    AllowOverride none 
#Import contents of wordpress .htaccess
<Directory /home/name_user/web/name_domain/public_html/> 
# BEGIN WordPress
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
# END WordPress

Do not copy directly Yes, match it with an existing configuration. Replace name_user and name_domain especially to your hosting structure, I based on VestaCP and this is no difference with the LAMP stack.