使用虚拟主机时删除Wordpress子文件夹中的index.php

使用虚拟主机时删除Wordpress子文件夹中的index.php,wordpress,virtualhost,redhat,Wordpress,Virtualhost,Redhat,我到处寻找这个问题的解决办法,但我所尝试的都没有奏效。当将permalink设置为/index.php/%postname%/时,它可以正常工作,但是当我删除index.php部分时,我只得到一个404,日志中有以下内容: [Tue Aug 13 05:05:46 2013] [error] [client 202.58.198.84] File does not exist: /var/www/html/domain1/postname, referer:..... 我有一个运行Apache

我到处寻找这个问题的解决办法,但我所尝试的都没有奏效。当将permalink设置为/index.php/%postname%/时,它可以正常工作,但是当我删除index.php部分时,我只得到一个404,日志中有以下内容:

[Tue Aug 13 05:05:46 2013] [error] [client 202.58.198.84] File does not exist: /var/www/html/domain1/postname, referer:.....
我有一个运行Apache的Red Hat Web服务器,它有两个Wordpress站点和虚拟主机。虚拟主机是这样的

<VirtualHost *:80>
  # General
  ServerAdmin info@domain1.com
  DocumentRoot /var/www/html/domain1
  ServerName domain1.com
  ServerAlias www.domain1.com

  # Logging
  ErrorLog logs/domain1-error_log
  CustomLog logs/domain1-access_log common
</VirtualHost>

没有任何运气

这不是一个大问题,但它让我很烦!如果有人能解决这个问题,我将不胜感激。

请确保:

  • 您的wordpress永久链接设置设置为/%postname%
  • .htaccess文件位于/var/www/html/domain1中(与domain2相同)
  • 您可以像这样为domain1/2目录指定一些规则(在配置文件中的
    标记之前添加这段代码):

    
    选项如下符号链接多视图
    允许超越所有
    命令允许,拒绝
    通融
    
<VirtualHost *:80>
  # General
  ServerAdmin info@domain2.com
  DocumentRoot /var/www/html/domain2
  ServerName domain2.com
  ServerAlias www.domain2.com

  # Logging
  ErrorLog logs/domain2-error_log
  CustomLog logs/domain2-access_log common
</VirtualHost>
# 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
RewriteBase /
RewriteBase /subfolder
<Directory /var/www/html/domain1>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>