-1

我正在 wordpress 中开发一个网站,并且我正在尝试编写一个简单的重写规则(所有这些文档似乎很简单)。

我需要更改http://www.mysite.com/fitness/wp-content/themes/fitness/favorites.phphttp://www.mysite.com/fitness/favorites. 健身是我的主目录。

我在.htaccess文件中尝试了以下模式,但它们都抛出 404 错误:

1. RewriteRule ^favorites$ /fitness/wp-content/themes/fitness/favorites.php

2. RewriteRule ^/favorites/$ /fitness/wp-content/themes/fitness/favorites.php

3. RewriteRule ^favorite\.php$ - [L]
   RewriteRule . /fitness/wp-content/themes/fitness/favorites.php [L]

我究竟做错了什么?

4

1 回答 1

0

试试这个代码。这会将您的旧 URL 简单地重定向到新 URL。

Options +FollowSymlinks
RewriteEngine on
rewriterule ^fitness/wp-content/themes/fitness/favorites.php(.*)$ http://www.mysite.com/fitness/favorites$1 [r=301,nc]
于 2013-05-15T14:27:40.153 回答