Search code examples
phpmysqlwordpressiiswindows-server-2012

WordPress Custom Structure permalinks breaks after migrating site to new domain and server


I had my WP on a site mysite1.com and am migrating it to mysite2.com, hosted on a different server. I simple ran a find-and-replace in the database, mysite1.com -> mysite2.com, and the homepage mysite2.com now works fine but all the subpages (mysite2.com/subpage1, mysite2.com/subpage2, mysite2.com/subpage1/thing?id=1, etc.) do not work. I'm using the Custom Structure http://mysite2.com/%postname%/, which worked just fine on mysite1.com. All the other Permalink structures work on mysite2.com, I might add. It's when I switch back to the custom structure that the subpages 404.

Could this have something to do with needing to configure my new server or php.ini or anything?

Any ideas on what may be the cause of the problem and what I can do to fix it?


Solution

  • Just try putting an .htaccess file on the root of your wordpress. Then change its permission to 755 and the change the permalink structure to postname.

    Here is sample .htacess file code.

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