WordPress Permalink 404 Error after Subdomain to Root Migration

孤街浪徒 提交于 2019-12-21 23:27:26

问题


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

The WordPress folder is located at 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.

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

回答1:


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

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.

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




回答2:


# 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



回答3:


I changed my permalink structure yesterday and verified that its 301 redirection. You can consider changing your .htaccess permission to 777 and then change to pretty permalink from default permalink. Once done, change back the permission of .htaccess to 777. Here is a quick tutorial: How to change WordPress permalink without 404 error



来源:https://stackoverflow.com/questions/7480699/wordpress-permalink-404-error-after-subdomain-to-root-migration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!