Apache mod_rewrite 有关 Wordpress 的帮助
我管理我妻子的网站,即marly.com。直到上周,博客的根页面是marly.com/blog/。
上周我在 WP 设置中将其更改为 isimarly.com。
WP 创建了新的 htaccess 文件,然后我按照指示将 index.php 移动到根目录(但将 WP 文件夹保留在 /blog/ 目录中)。除了一件非常重要的事情之外,一切都运行良好:
现在当您在浏览器中输入“namelymarly.com/blog/”时,您会收到 404 错误。
所有其他 URL,当它们包含“/blog/somethinghere”时,将正确重定向到“/somethinghere”。只有当“/blog/”后面没有任何内容时,才会出现问题。
我尝试添加此规则,但它仍然重定向到 404 页面:
RewriteRule ^/blog/$ /index.php
有任何建议/帮助吗?
I administer my wife's site, namelymarly.com. Up until last week, the root page of the blog was namelymarly.com/blog/.
Last week I changed it in the WP settings to be namelymarly.com.
WP created the new htaccess file, and I moved the index.php to the root directory (but left the WP folder where it was in the /blog/ directory), as instructed. Everything is working great except for one very important thing:
When you type 'namelymarly.com/blog/' into a browser now, you get a 404 error.
All other URLs, when they include the '/blog/somethinghere', will redirect properly to '/somethinghere.' It's only when there's nothing after '/blog/' that there's a problem.
I tried adding this rule but it still redirects to the 404 page:
RewriteRule ^/blog/$ /index.php
Any suggestions/help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
安装“重定向”,然后添加从 isiemarly.com/blog/ 到 isimarly 的 301 重定向.com
install "Redirection" and then add a 301 redirect from namelymarly.com/blog/ to namelymarly.com
您是否遵循以下指示?: 移动 WordPress « WordPress Codex
您不需要重定向插件。如果您重新生成 Permalik,Wordpress 会处理重定向。如果必须,请在 WordPress 重写块之前的 .htaccess 中使用此内容:
重定向 301 /blog http://namelymarly.com
但首先,请确保您已在仪表板/设置/永久链接中重置永久链接,并确保自己将更改复制到 .htaccess,并且文件中只有最新的 - 最后一个 - 重写块(WP 有一个向 .htaccess 添加越来越多的重写块的习惯)。
并在帖子/页面编辑器中检查其他 URL 的 URL,看看它们是否包含 /blog/
Did you follow these diections?: Moving WordPress « WordPress Codex
You don't need the redirection plugin. Wordpress handles redirects if you regenerate permaliks. If you have to, use this in .htaccess before the Wordpress rewrite block:
Redirect 301 /blog http://namelymarly.com
But first, be sure you've reset your permalinks in Dashboard/Settings/Permalinks and make sure that copy the changes to .htaccess yourself and that there is only the most recent - the last - rewrite block in the file (WP has a habit of adding more and more rewrite blocks to .htaccess).
And check the URLs of your other URLs in the post/page editor and see if they contain /blog/