除非使用 [R],否则 URL 重写不适用于 wordpress
我在我的网站上的 blog-ita/
文件夹中安装了 Wordpress.现在,我想添加一个重写规则以允许从 website-name/blog/
访问它.
I have a Wordpress installation on my website on the folder blog-ita/
. Now, I'd like to add a rewrite rule to allow accessing it from website-name/blog/
.
我使用了这个重写规则:
I used this rewrite rule:
RewriteRule ^website-name/blog/(.*)$ blog-ita/$1
现在,如果我添加 [R] 标签,这会起作用,否则我会从 wordpress 获得 404 not found 页面,而不是我想要查看的页面.
Now, this works if I add the [R] tag, but otherwise I get the 404 not found page from wordpress instead of the page I wanted to see.
怎么会这样?如果没有 [R]
标志,我怎样才能使这项工作正常进行?
How can that be? How can I make this work without the [R]
flag?
您可以从 本指南关注Wordpress 使 Wordpress 在与 wordpress 实际所在的目录不同的目录中工作.
You can follow this guide from Wordpress to get Wordpress to work in a different directory than wordpress is actually located.
您想在 blog-ita
目录中安装 wordpress.您希望 url 改为显示 website-name/blog
.请按照以下步骤操作:
You want to install wordpress in the blog-ita
directory. You want the url to show website-name/blog
instead. Follow the following steps:
- 转到管理部分的常规"面板并更改/选中以下框,然后保存更改:
- 站点地址 (URL):将其更改为
http://example.com/website-name/blog
- 确保 WordPress 地址正确配置为
htttp://example.com/blog-ita
.
- 站点地址 (URL):将其更改为
从现在开始,wordpress 应该可以在 http://example.com/website-name/blog/
上使用.admin 部分仅在实际安装目录 (/blog-ita/admin
) 中可用.
From this point on, wordpress should be available at http://example.com/website-name/blog/
. The admin section is only available at the actual installation directory (/blog-ita/admin
).