I have recently changed hosting of my WordPress site to VPS.net. I have moved all of my files and imported the database. Everything appeared to be fine until I clicked a link and noticed that all of my pages are bringing back a 404 except the homepage.

Site URL is http://inksquared.com


6 Answers 6


I guess you get http://yoursite but not http://yoursite/anything

I had a similar problem and it worked when I changed

the httpd.conf from

AllowOverride None


AllowOverride All

It makes the .htaccess take effect.

  • 6
    This one worked for me. Most of the people forget about this.
    – qasimzee
    Commented Dec 10, 2014 at 18:20
  • 1
    This worked for me too, only had to change it in the section of apache2.conf for the location of my server files, /var/www in my case
    – sponrad
    Commented Nov 17, 2015 at 6:04
  • 1
    This was part of the answer for me. I added AllowOverride All to the site configuration, but I also added Options FollowSymLinks. I was then able to use custom permalinks, which also created an appropriate root .htaccess file. After that everything worked.
    – boot13
    Commented Sep 12, 2016 at 23:46
  • 1
    And don't forget to restart apache! "sudo service apache2 restart"
    – gradosevic
    Commented Jan 11, 2017 at 7:51
  • 1
    It worked. Make sure you change the AllowOverride option at locations in the conf file.
    – Najeeb
    Commented Dec 19, 2017 at 13:54

Try flushing your mod_rewrite rules:

Dashboard -> Settings -> Permalinks

Save settings (no need to make any changes)

  • 8
    No need to even save, actually. The rules are flushed just by visiting that page, and part of flushing the rules involves writing to .htaccess. Commented Apr 13, 2011 at 18:49
  • I learn something new every day... :) Commented Apr 13, 2011 at 18:51
  • @john are you sure that just page loads write to .htaccess if it needs to? I was under the impression that only rewrite_rules in the database are flushed.
    – Ashfame
    Commented Apr 13, 2011 at 19:00
  • wp-admin/options-permalinks.php calls flush_rewrite_rules(), a wrapper for WP_Rewrite::flush_rules(), which, if $hard is true (which it is when called on that page) and the function save_mod_rewrite_rules exists (defined in wp-admin/includes/misc.php, included in all admin pages), it calls save_mod_rewrite_rules(). See that function's definition here: core.trac.wordpress.org/browser/trunk/wp-admin/includes/… Commented Apr 13, 2011 at 20:32
  • The function that actually writes the rewrite rules to .htaccess is called insert_with_markers (used in save_mod_rewrite_rules() above), defined here: core.trac.wordpress.org/browser/trunk/wp-admin/includes/… Commented Apr 13, 2011 at 20:33

I had faced the same problem.

I did the following to resolve it on an Ubuntu Server:

  1. In /etc/apache2/apache2.conf, edit AllowOverride None for /var/www/ to AllowOverride All

  2. Type in the following command to enable mod_rewrite for .htaccess

sudo a2enmod rewrite

  1. Restart your apache server:

sudo service apache2 restart

The problem solved!!!

  • 1
    Thanks, I couldn't get this fixed with any of the other suggestions, but a2enmod rewrite did the trick. Commented Jun 23, 2017 at 18:17
  • +1 For mentioning the rewrite mod. Didn't realize that this wasn't enabled by default. Commented Dec 13, 2017 at 3:35
  • Definitely needed that sudo a2enmod rewrite to get this wokring, thanks!
    – Huskie69
    Commented Oct 5, 2018 at 9:31
  • 1
    Thanks! The command a2enmod rewritedid the trick for me. Commented Oct 17, 2018 at 15:46
  • Thanks Avinash! Same with Lucas, the a2enmod rewrite did the trick for me Commented Nov 25, 2019 at 21:52

In Ubuntu 14.04 - the 000-default.conf file can be found here /etc/apache2/sites-available

Or if you run multiple wp the virtual host setting would be your config file name. e.g. domain.conf

You have to replace AllowOverride None to AllowOverride All

Hope this will work.


The reason is most likely that the .htaccess file wasn't copied over. On Mac OS X, and in some FTP applications, this file is considered "hidden" because it starts with a .. If you go to the Settings -> Permalinks section in your admin section, you can regenerate this file, but it's probably best to find the version you had previously and use that again (especially if you use a caching plugin).


Do you get a web server 404 or a WordPress 404? If it's a web server 404, you most likely didn't copy the root htaccess file over from the old installation, or it doesn't have correct permissions to run.

My first troubleshooting item would be to check and see if an htaccess file exists in the root. And if so, what it contains.

  • Checked the .htaccess file. It contains the same code that appeared in the permalink section of the wordpress admin panel. I changed the permissions to writable and can see no apparent changes.
    – mikeyrocks
    Commented Apr 13, 2011 at 19:17
  • 3
    @mikeyrocks Hmm... another possibility is that your new server doesn't have mod_rewrite turned on. Important: are you getting a server 404 (plain white page that says "not found"), or a WordPress 404 (styled like the rest of your site)?
    – MathSmath
    Commented Apr 13, 2011 at 20:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.