wiwa1978
wiwa1978

Reputation: 2707

Wordpress issue after migration

Have changed to a new server and have migrated a number of Wordpress sites. After migration, I found that the menu links were no longer working. The content is there however.

I deleted the htaccess file and changed the permalinks to the default setting 'plain'. That worked fine. However, now my website is working with menu links like domain.com/?page_id=29.

On the old server, I have always been using the format domain.com/post_name. So I deleted the htaccess file again and changed the permalink to post_name, but clicking on the link in the menu always gives me a 404 error. Checked a phpinfo() and mod_rewrite is enabled.

The htaccess file right now is:

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

How to get back working menu links when permalinks are set to postname?

Upvotes: 0

Views: 147

Answers (3)

Nmk
Nmk

Reputation: 1321

On Linux, in order to relax access to the document root, you should edit the following file: /etc/httpd/conf/httpd.conf

In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf (here we have an example of /var/www)

And depending on what directory level you want to relax access to, you have to change the directive

AllowOverride None

to

AllowOverride All

So, assuming you want to allow access to files on the /var/www/html directory, you should change the following lines from:

<Directory "/var/www/html">
 AllowOverride None
</Directory>

to

<Directory "/var/www/html">
 AllowOverride All
</Directory>

Upvotes: 1

Lavender Host
Lavender Host

Reputation: 1

Issue can be the path of the files as well. Do you migrate the account with same username and same path as of the old server ?

If path is different than the old server, take a mysql dump of the db, look for the path and change them to the correct new path.

If paths are same, then you could fix this issue by just resetting the permalinks i.e first change the permalinks to some other one than the current one and save and then immediately change back to old one which was in use earlier and then again save it. This have worked for me in past.

Upvotes: 0

Paul Dunlop
Paul Dunlop

Reputation: 327

Reference Docs for you: https://codex.wordpress.org/Using_Permalinks

I take it when you say the menu lnks stopped working again you mean to say that the link changes fine to the new permalink format of http://domain/post_name right?

If so you're issue lies in mod_redirect. Either in the .htaccess in the docroot (turning it on and having correct redirect rules) or it could in your apache web server config file. perhaps apache doesn't even have mod_redirect enabled. if it's a CPANEL server mod_redirect is likely to be enabled however.

Upvotes: 0

Related Questions