如何从我的htaccess命令中排除文件夹

时间:2012-08-21 22:15:02

标签: wordpress .htaccess

我在我的主根中有followind 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>

1 个答案:

答案 0 :(得分:0)

要从htaccess中排除文件,您可以使用简单的方法将htaccess文件放在目录中:

RewriteEngine On

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

RewriteRule ^directory_you_want_to_protect - [L]

但我怀疑这里真的是XY Problem。您可能需要将wordpress所需的htaccess规则与您现在拥有的规则重新组合或合并。它们可能不完全兼容。如果无法运行安装程序,只需暂时删除root的htaccess文件,安装wordpress,然后找出如何组合规则。