我有一个XAMPP的本地安装,无论我放在.htaccess
内的任何指令它都不会影响任何内容,然后在Apache Server Config
文件中找到AllowOverride none
。您是否认为AllowOverride none
是.htaccess
所做的更改没有产生任何影响的原因?同样的.htaccess
文件在我正在使用的网络托管上也能正常工作。
答案 0 :(得分:1)
是。 AllowOverride
控制.htaccess
文件中可以执行的操作。请参阅the documentation for the AllowOverride
directive。
答案 1 :(得分:0)
在默认的XAMPP开箱即用安装httpd.conf文件:/xampp/apache/conf/httpd.conf中有这个代码,我从来没有改变过,一切正常,但我使用的是vhost配置。 vhost是处理多个XAMPP开发站点的更好方法,因为您可以更改每个站点的配置,而不是影响所有XAMPP开发站点。 vhost conf文件位于:/xampp/apache/conf/extra/httpd-vhosts.conf。我在下面发布了一个简单的例子httpd-vhosts.conf文件中也有示例。设置/配置似乎很难,但事实并非如此。就像我说的,这是设置多个开发站点的最佳方式。这看起来像一个体面的虚拟机设置教程: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配置示例:
## 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>