0

我已经切换到一个新的网站设计(从静态到 wordpress),所以为了将旧页面映射到新页面,我编辑了 htacess 文件,但它导致了重定向循环,并且网站在几天后关闭了。所以我删除了htacess 文件。我应该如何进行正确的重定向。

这是来自 htacess 的重定向代码内容

    # 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


Redirect /test1.htm http://www.mysite.com/test1

Redirect /test2.htm http://www.mysite.com/test2
4

1 回答 1

1

Redirect是来自与 is 不同模块的命令RewriteRule。这会经常引起问题。

只需使用RewriteRule.

#just in case test.html still exists in the filesystem
Options -MultiViews

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^test1\.htm /test1 [L,R=302]
RewriteRule ^test2\.htm /test2 [L,R=302]

# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
于 2012-12-07T16:03:37.550 回答