Fixing Permalinks After Migration of Your WordPress.

Just successfully migrated my Codejacks blog to my  VPN running on 2GB RAM and SSD storage. Although it may not be as fast or famous as other VPN’s such as Linode,blah blah whatever, but I have been successfuly running my campaigns,tracker on this VPN for so long that I need to look through the invoice logs to check when I really opened an account with them.

This post is basically for those who face problem similar to mine, that after migrating the blog to another host or server, face the issue that plugins not working, permalinks not working etc etc.

Here are the few steps that need to be follwed to fix it, that I did to fix mine.

For this I followed below steps.

  1. Manually create a “.htaccess” file and save it in your main WordPress directory. (This is the one with the wp-admin, wp-includes, and wp-content folders.)
  2. Go to the Ubuntu terminal and type:sudo chown -v :www-data “/FilePathHere/.htaccess”

You should see a line printed saying that the (group) file ownership has been changed to www-data (Apache2).

  1. Give Apache2 write access to the file:sudo chmod -v 664 “/FilePathHere/.htaccess”

You should see a line printed saying that the mode of the file has been retained.

  1. Next, we have to allow WordPress to write to the .htaccess file by enabling mod_write in the Apache2 server. Type the following in the terminal:sudo a2enmod rewrite

You should see a line printed saying that it is enabling mod rewrite and reminding you to restart the web server

  1. So let’s do that. Restart the web server, Apache2, for the changes to take effect by typing:sudo /etc/init.d/apache2 restart

We are all done with the command line prompt; you can close the command line window now.

  1. Go into your WordPress admin panel (i.e. http://Domain/wp-admin). Go to the Settings –> Permalinks and select the permalink format of your choice. Hit the “Save Changes” button.