0

我的主根目录中有以下 htaccess ......但我想排除一个子域文件夹来安装 wordpress ......实际上我试图安装的 wordpress 给出了错误,当我删除这个 htaccess 时,wordpress 工作正常.. 。 谢谢

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On

  # Get rid of index.php
  RewriteCond %{REQUEST_URI} /index\.php
  RewriteRule (.*) index.php?rewrite=2 [L,QSA]

  # Rewrite all directory-looking urls
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*) index.php?rewrite=1 [L,QSA]

  # Try to route missing files
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} public\/ [OR]
  RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
  RewriteRule . - [L]

  # If the file doesn't exist, rewrite to index
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]

</IfModule>
4

1 回答 1

0

要从 htaccess 中排除文件,您可以在目录中放置一个 htaccess 文件,方法很简单:

RewriteEngine On

否则,在根文件夹的 htaccess 文件中,您可以在下面添加RewriteEngine On

RewriteRule ^directory_you_want_to_protect - [L]

但我怀疑这真的是一个XY 问题。您可能需要修改或结合 wordpress 所需的 htaccess 规则与您现在拥有的规则。它们可能不完全兼容。如果是无法运行安装程序的问题,只需暂时删除root的htaccess文件,安装wordpress,然后弄清楚如何组合规则。

于 2012-08-21T22:28:32.577 回答