mod_rewrite / htaccess 不起作用

mod_rewrite / htaccess 不起作用

我无法让 mod_rewrite 在客户端站点上工作,它只是完全忽略 .htaccess 文件。

我不是 100% 确定正在使用什么版本的 Linux,它似乎是 CentOs。

我检查了该httpd.conf文件并且 mod_rewrite 已启用。我已将httpd-vhosts.conf文件更改为AllowOverrides All.

以下是该文件的相关内容data/lampp/etc/httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
Options FollowSymLinks
AllowOverride None
#XAMPP
#Order deny,allow
#Deny from all
</Directory>

<Directory "/opt/lampp/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes


#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>

#
# "/opt/lampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/lampp/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

# Virtual hosts
Include etc/extra/httpd-vhosts.conf

# XAMPP
Include etc/extra/httpd-xampp.conf

这是内容data/lampp/etc/extra/httpd-vhosts.conf

NameVirtualHost *:80

<Directory "/opt/lampp/htdocs/mydomain">
AllowOverride All
Order allow,deny
allow from all
</Directory>

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /opt/lampp/htdocs
ServerName xxx.xxx.xxx.xxx
</VirtualHost>

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /opt/lampp/htdocs/mydomain
RewriteEngine On
</VirtualHost>

我的.htaccess文件仅包含以下内容:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^.*$ htaccess_tester.php
</IfModule>

我找不到 apache 的任何错误日志。我一定是在某个地方遗漏了一些东西......!

相关内容