Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress issue: after migration only homepage works

A few days ago I tried transferring my wordpress website from shared hosting to vps but I've run into a problem.

After following many guides/tutorials and googling myself I can't figure out why it's not working. The homepage is the only page that loads all other pages 404. I've included some relevant files.

Does anyone have any ideas?

HTACCESS

httpd.conf

Partial directory listing - www.pastebin.com/BCPfRisB

Thanks in advance

like image 456
Forrestgump360 Avatar asked Feb 10 '17 15:02

Forrestgump360


People also ask

How long does it take to migrate a WordPress site?

A WordPress migration with the Migrator plugin does not take more than 24 hours. In most cases, it is completed within a few hours. This is valid for the cases in which there are no technical issues that might interfere with the migration.


3 Answers

  1. Login to your wp-admin
  2. Go to Settings > Permalinks
  3. Don't make any changes, just click "Save Changes" button.

Your site's secondary page would work now.

like image 110
hemnath mouli Avatar answered Sep 29 '22 16:09

hemnath mouli


I too have the same issue, fixed it creating .htaccess in the root directory with following content:

/var/www/html/.htaccess

# 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

Along with editing httpd.conf placed in /etc/httpd/conf to set value of AllowOverride directive to All for the /var/www/html directory, as below:

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

And finally restarting apache:

sudo service httpd restart

For all the steps related to deployment you can find here - Hosting WordPress Application on Centos Box.

like image 21
Arpit Aggarwal Avatar answered Sep 29 '22 16:09

Arpit Aggarwal


I posted this answer because I didn't find an answer which offered all possible solutions. Consider this answer as a pleasant checklist which should help you to fix this issue.

a) Permalinks update. The following steps rebuild the internal settings.

a) Login to your WordPress dashboard.
b) Go to Settings -> Permalinks.
c) Don't make any changes, just click "Save Changes" button.


b) .htaccess needs the settings for the rewrite engine:

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

c) Also, due to an error in the Apache log file the following entry was needed as well in the your-wordpress.conf Apache file which is mostly in the /etc/apache2/vhostd.d directory.

<Directory your-wordpress-directory>
  Options Indexes FollowSymLinks
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>

d) Assure mod_rewrite is enabled

a2enmod rewrite
Restart Apache
like image 42
Peter VARGA Avatar answered Sep 29 '22 16:09

Peter VARGA