user3461957
user3461957

Reputation: 163

.Htaccess file not working, does this have anything to do with AllowOverride?

I have a local installation of XAMPP, whatever directives I put inside .htaccess it does not affect anything, then in Apache Server Config file I found AllowOverride none. Do you think AllowOverride none is the reason that changes made in .htaccess are not taking any effect? Also same .htaccess file works fine on a web hosting I am using.

Upvotes: 0

Views: 73

Answers (2)

Ed-AITpro
Ed-AITpro

Reputation: 340

In a default XAMPP out of the box installation the httpd.conf file here: /xampp/apache/conf/httpd.conf has this code in it, which I have never changed and everything works fine, but I am using a vhost configuration. vhost is a much better way to handle multiple XAMPP development sites since you can change your configuration per site instead of affecting all XAMPP dev sites. The vhost conf file is here: /xampp/apache/conf/extra/httpd-vhosts.conf. I posted a simple example below. the httpd-vhosts.conf file also has examples in it. It seems like a difficult thing to setup/configure, but it is not. Like I said this is the best way to setup multiple dev sites. This looks like a decent vhost setup tutorial: http://austin.passy.co/2012/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

Vhost config example:

## AITpro Main site
<VirtualHost aitpro-main.local:80>
    ServerAdmin postmaster@localhost
    DocumentRoot "C:/xampp/htdocs1/aitpro-main"
    ServerName aitpro-main.local
    ServerAlias aitpro-main.local
    <Directory "C:/xampp/htdocs1/aitpro-main">
    #Options Indexes FollowSymLinks Includes ExecCGI
    Options All
        AllowOverride All
        Require all granted
        #Order allow,deny
        #Allow from all
</Directory>
</VirtualHost>

Upvotes: 0

Wim Lewis
Wim Lewis

Reputation: 402

Yes. AllowOverride controls what can be done in an .htaccess file. See the documentation for the AllowOverride directive.

Upvotes: 1

Related Questions