0

I am using ubuntu 14.04 and have LAMP environment. I have one of the project in dir /var/www/html/project1 . It can't access the .htaccess file for rewriting url rules.

For that i have to change in /etc/apache2/apache2.conf file

 <Directory /var/www/>
      Options Indexes FollowSymLinks
      AllowOverride All       # change None to All
      Order allow,deny
      allow from all
      Require all granted
 </Directory>

But after this change my Apache server gives an error "Internal Server error" and apache give error for any website (project).

And If I'll change 'AllowOverride None' then site is running correctly But .htaccess file doesn't work.

The 'Internal Server Error' is due to .htaccess file in another project which is like this

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L] 

I can't understand anything in htaccess file. Plz help me in to rewrite the htaccess file and meaning of the same.

Thanks

1 Answer 1

2

Instead of changing the directive in the default block you should use a separate block specifically for your project directory:

<Directory /var/www/html/project1>
  Options Indexes FollowSymLinks
  AllowOverride All
  Order allow,deny
  allow from all
  Require all granted
</Directory>

This will only allow .htaccess files to be used in this specific directory.

The 500 error that you are getting is probably due to some bad syntax in a .htaccess file. It would be helpful if you showed us what you have in all of the .htaccess files.

Alternatively you can look in the Apache error logs at /var/log/apache2/error.log for more specific information about the error.

1
  • Thanks, It solves my problem. But I guess one of my htaccess file cause Internal Server error this is as bellow
    – Farman Ali
    Jun 26, 2015 at 5:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .