Taha
Taha

Reputation: 55

WordPress redirection gives 404 after moving site from a server to another

After migrating my WordPress sites from my old hosting provider to my new VPS thought my sites works fine but it was giving 404 not found everywhere it's a redirection issue because the home page is working fine.

My rewrite mod is activated, the .htaccess is the default WordPress one, for migrating the site I proceed like this:

  1. I copy the old files in the right vhost folder
  2. I create a mysql username and database for the new server
  3. I update the wp-config.php file with the new params.
  4. I import the old database to the new empty database

I copied this from WordPress official documentation and it worked fine for other sites but now it's not working.

Tried to google the issue but I haven't got the solution.

This is my .htaccess file (standard wordpress):

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

AddHandler x-mapp-php5.5  .php

# BEGIN WordPress

# END WordPress

Upvotes: 1

Views: 1325

Answers (1)

Taha
Taha

Reputation: 55

The solution is so simple but can be caused by various factors

1) You must check if your apache mod_rewrite is enabled

2) Check if Allowoverride is set to All

3) Check if you have a .htaccess file

4) Check if Wordpress have the right to write on it (chmod 666 .htaccess)

for %postname% permalink check if you have a similar .htaccess to this one :

#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>

AddHandler x-mapp-php5.5  .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

For my case i forgot to set Allowoverride in a correct way

Upvotes: 1

Related Questions