Wordpress issue: after migration only homepage works
- Login to your wp-admin
- Go to Settings > Permalinks
- Don't make any changes, just click "Save Changes" button.
Your site's secondary page would work now.
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 OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /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 FollowSymLinksAllowOverride AllOrder allow,denyAllow 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.
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 rewriteRestart Apache