开发者

WordPress Permalink 404 Error after Subdomain to Root Migration

开发者 https://www.devze.com 2023-04-05 20:53 出处:网络
I have a WordPress installatio开发者_如何学JAVAn at Subdomain. I wish to have the website display the blog at http://www.website.com

I have a WordPress installatio开发者_如何学JAVAn 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


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


# 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. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消