简体   繁体   English

子域到根迁移后WordPress永久链接404错误

[英]WordPress Permalink 404 Error after Subdomain to Root Migration

I have a WordPress installation at Subdomain. 我在Subdomain安装了一个WordPress。 I wish to have the website display the blog at http://www.website.com 我希望网站在http://www.website.com上显示博客

The WordPress folder is located at http://www.website.com/wordpress/ WordPress文件夹位于http://www.website.com/wordpress/

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. 对于默认的永久链接结构,它很好,但对于/%postname%/它显示404错误。

This is the .htaccess code WP has generated in the root 这是WP在根中生成的.htaccess代码

# 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

I got the permalinks to work for Godaddy. 我得到了为Godaddy工作的永久链接。 I had to add an extra line in .htaccess to make this work. 我必须在.htaccess中添加一个额外的行来完成这项工作。 GoDaddy appears to be taking 404 error page over .htaccess and thus was giving errors for all pretty permalink request. GoDaddy似乎在.htaccess上占用404错误页面,因此给出了所有非常永久链接请求的错误。

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

The ErrorDocument 404 /index.php line above makes all the difference with GoDaddy. 上面的ErrorDocument 404 /index.php行与GoDaddy有所不同。 It forces handling of 404 error with that of WordPress index page and works fine. 它强制处理404错误与WordPress索引页面的错误,并正常工作。

Hope this helps everyone trying to make pretty permalinks like %postname% work with Godaddy 希望这有助于每个人都试图制作像%postname%这样的永久链接与Godaddy合作

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress

I changed my permalink structure yesterday and verified that its 301 redirection. 我昨天改变了我的永久链接结构并验证了它的301重定向。 You can consider changing your .htaccess permission to 777 and then change to pretty permalink from default permalink. 您可以考虑将.htaccess权限更改为777,然后从默认永久链接更改为非常永久链接。 Once done, change back the permission of .htaccess to 777. Here is a quick tutorial: How to change WordPress permalink without 404 error 完成后,将.htaccess的权限更改为777.这是一个快速教程: 如何在没有404错误的情况下更改WordPress永久链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM