Apache mod_rewrite Alias被Wordpress重写规则覆盖

时间:2013-03-28 01:08:25

标签: wordpress apache .htaccess mod-rewrite saml-2.0

我在同一个盒子上有一个Wordpress实例和一个SimpleSAMLphp实例,需要从同一个子域访问,似乎Wordpress正在干扰Apache Alias。

的httpd.conf

#
# VHOST for the Wordpress instance and provides an alias
# so simpleSAMLphp can be accessed at saml.domain.com/saml
#
<VirtualHost *:80>
        RewriteEngine On
        RewriteCond %{SERVER_PORT} !^443$
        RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
<VirtualHost *:443>
        ServerAdmin admin@domain.com
        ErrorLog logs/saml.domain.com-error_log
        CustomLog logs/saml.domain.com-access_log common

        SSLEngine On
        SSLCertificateFile /etc/pki/tls/certs/ca.crt
        SSLCertificateKeyFile /etc/pki/tls/private/ca.key

        RewriteLog "/var/log/httpd/mod_rewrite.log"

        ServerName saml.domain.com
        DocumentRoot "/var/www/html"
        <Directory "/var/www/html">
                Options All
                AllowOverride All
                Require all granted
        </Directory>

        Alias /saml "/var/simplesamlphp/www"
        <Directory "/var/simplesamlphp/www">
                Options All
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

的.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

的/ var /日志/ httpd的/ ssl_error_log

[Wed Mar 27 18:00:03 2013] [error] [client 10.0.3.133] File does not exist: /var/www/html/favicon.ico
[Wed Mar 27 18:00:05 2013] [error] [client 10.0.3.133] File does not exist: /var/www/simplesamlphp
[Wed Mar 27 18:00:05 2013] [error] [client 10.0.3.133] File does not exist: /var/www/html/favicon.ico
[Wed Mar 27 18:03:46 2013] [error] [client 10.0.3.133] File does not exist: /var/www/html/favicon.ico
[Wed Mar 27 18:03:47 2013] [error] [client 10.0.3.133] File does not exist: /var/www/html/favicon.ico
[Wed Mar 27 18:03:56 2013] [error] [client 10.0.3.133] File does not exist: /var/www/simplesamlphp

/var/log/httpd/mod_rewrite.log

该文件为空白

http://saml.domain.com/saml = simpleSAMLphp管理菜单。

http://saml.domain.com/anything-else = Wordpress页面

转到saml.domain.com/saml的结果是Wordpress 404页面。在强制使用SSL并修复Wordpress重写之前,我有这个工作,所以如果有人有任何有用的信息会很棒!

提前致谢!

1 个答案:

答案 0 :(得分:0)

问题是我在 /etc/httpd/conf/httpd.conf 中指定了SSL Vhost而不是 /etc/httpd/conf.d/ssl.conf

这样做的结果是Apache随附的狡猾的SSL Vhost覆盖了我的 httpd.conf 。我所要做的就是删除 httpd.conf 中的SSL Vhost声明,并将其与 ssl.conf

中的声明合并。