1

我将 wordpress 安装在http://example.com. 我创建了名为 world 的新文件夹http://example.com/world,我需要 htaccess 单独处理该特定文件夹,这可能吗?

下面给出了我需要用于文件夹世界的 htaccess。我在 rootfolder htaccess 中添加了这个,我得到了内部服务器错误,因此我不想打扰根文件夹。

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (.*)(\/?)$ / [QSA,NC,L]

我的根文件夹 htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
4

1 回答 1

1

DOCUMENT_ROOT/.htaccess用以下代码替换您的:

# BEGIN WordPress
<IfModule mod_rewrite.c>

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# don't do anything for /world folder
RewriteRule ^world/ - [L,NC]

RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>
# END WordPress

DOCUMENT_ROOT/world/.htaccess用以下代码替换您的:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /world/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ index.php [L]
于 2013-09-25T18:32:36.590 回答