Hy my apache2.4.6 is not reading htaccess files

My 000-default.conf file is

<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 appear 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
    DocumentRoot /var/www
    <Directory "/var/www">
   Order allow,deny
   Allow from all
   AllowOverride FileInfo
   # New directive needed in Apache 2.4.3: 
   Require all granted
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    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


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

Oh and my htacess file in wordpress was working on an older version of apache so that is not the problem

Thanks for any help

Recommended Answers

All 8 Replies

At line 19 close the tag </Directory>. Then reload Apache and it should work. Also consider to enable the ServerName at line 9.

Sorry it tokk me so long to reply.
Thank you for the reply but unfortunately the server is not rewriting anything.
I closed the </Directory> tag but it's not happening
Oh and i would like to use the localhost as my servername

Can anyone show me what's wrong?

No problem. Are you sure .htaccess is not read? Can you show his contents? Do you get any message in the error.log file?

There could be a misconfiguration, for example with the actual setting if there is an Options call, the .htaccess will generate an error.

Most of the times you can place in the config file the same code that you would write into an .htaccess file, it will execute faster. So if in your old installation there were other settings, then this can explain the errors you get now. Right now the easiest test you can perform is to change AllowOverride to All and reload Apache.

I didn't edit any settings in my old apache it worked out of the box I just enabled apache rewrite,I tried your suggestion no luck.
Thank you

My htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

# END WordPress

Thank you

No errors apache2 log

[Sat Nov 16 20:28:58.740796 2013] [mpm_prefork:notice] [pid 1451] AH00163: Apache/2.4.6 (Ubuntu) PHP/5.5.3-1ubuntu2 configured -- resuming normal operations
[Sat Nov 16 20:28:58.740913 2013] [core:notice] [pid 1451] AH00094: Command line: '/usr/sbin/apache2'

Afetr modifications

Thank you

Ok, I do not see anything wrong. Maybe mod_rewrite is not enabled? You can check by running:

apache2ctl -M

Or in case of a Windows box:

httpd -M

Or simply remove the IfModule statements and see if it generates an error.

sudo a2enmod rewritemod rewrite is 100% enabled I even reinstaled it
I will try to remove IfModule.
Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.