子域到根迁移后的WordPress Permalink 404错误 [英] WordPress Permalink 404 Error after Subdomain to Root Migration

查看:67
本文介绍了子域到根迁移后的WordPress Permalink 404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Subdomain上安装了WordPress. 我希望网站在 http://www.website.com

I have a WordPress installation at Subdomain. I wish to have the website display the blog at http://www.website.com

WordPress文件夹位于 http://www.website.com/wordpress/

The WordPress folder is located at http://www.website.com/wordpress/

迁移已完成,但是漂亮的永久链接不起作用.对于默认的永久链接结构,它很好,但对于/%postname%/,它显示404错误.

The migration is complete but the pretty permalinks do not work. For the default permalink structure, its fine but for /%postname%/ it displays 404 Errors.

这是WP在根目录中生成的.htaccess代码

This is the .htaccess code WP has generated in the root

# 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

推荐答案

我获得了为Godaddy工作的固定链接.我必须在.htaccess中添加额外的一行以使其工作. GoDaddy似乎在.htaccess上收到404错误页面,因此在所有漂亮的永久链接请求中都给出了错误.

I got the permalinks to work for Godaddy. I had to add an extra line in .htaccess to make this work. GoDaddy appears to be taking 404 error page over .htaccess and thus was giving errors for all pretty permalink request.

ErrorDocument 404 /index.php

# 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

上面的 ErrorDocument 404/index.php 行与GoDaddy有所不同.它可以用WordPress索引页强制处理404错误,并且可以正常工作.

The ErrorDocument 404 /index.php line above makes all the difference with GoDaddy. It forces handling of 404 error with that of WordPress index page and works fine.

希望这可以帮助所有人尝试使像%postname%这样的永久链接与Godaddy合作

Hope this helps everyone trying to make pretty permalinks like %postname% work with Godaddy

这篇关于子域到根迁移后的WordPress Permalink 404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆