0

我在根目录和一个与 Wordpress 无关的特定文件夹中安装了 Wordpress。我为特定文件夹创建了一个 .htaccess 文件,但它不起作用。Wordpress .htaccess 总是被调用。

WordPress .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

特定文件夹 .htaccess:

//301 Redirect Old File
Redirect 301 http://www.domain.com/folder/start.php http://www.domain.com/folder/index.php

当我加载上述旧地址(不存在)时,会调用 Wordpress .htaccess,而不是使用文件夹的 .htaccess 进行重定向。

4

1 回答 1

1

You don't need multiple .htaccess you can put all the rules on the WordPress main .htaccess:

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

Use either:

RewriteRule ^folder/start\.php$ /folder/index.php [R=301,L,NC]

Or

Redirect 301 /folder/start.php http://www.domain.com/folder/index.php

Don't forget to change folder to your actual folder name.

于 2013-07-15T17:34:32.557 回答