Question: 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?

Answer: 
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

```html
AllowOverride None

```

to

```css
AllowOverride All

```

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

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

```

to

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

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