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


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.

| improve this answer | |
  • 6
    This one worked for me. Most of the people forget about this. – qasimzee Dec 10 '14 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 Nov 17 '15 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 Sep 12 '16 at 23:46
  • 1
    And don't forget to restart apache! "sudo service apache2 restart" – gradosevic Jan 11 '17 at 7:51
  • 1
    It worked. Make sure you change the AllowOverride option at locations in the conf file. – Najeeb Dec 19 '17 at 13:54

Try flushing your mod_rewrite rules:

Dashboard -> Settings -> Permalinks

Save settings (no need to make any changes)

| improve this answer | |
  • 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. – John P Bloch Apr 13 '11 at 18:49
  • I learn something new every day... :) – Chip Bennett Apr 13 '11 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 Apr 13 '11 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/… – John P Bloch Apr 13 '11 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/… – John P Bloch Apr 13 '11 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!!!

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

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

| improve this answer | |

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.

| improve this answer | |

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.

| improve this answer | |
  • 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 Apr 13 '11 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 Apr 13 '11 at 20:11

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