Search code examples
wordpress.htaccesspermalinks

WordPress Permalink 404 Error after Subdomain to Root Migration


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

Solution

  • 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