1
votes

I have migrated WordPress website to new server (Ubuntu) which is working fine.

But Permalinks settings are not working. All other pages returning me 404 error.

I already enabled mod_rewrite

When I use custom structure and type /%postname% it shows Permalink structure updated. and while visiting the page it returns be 404 error.

I am using /var/www/html/wordpress Installation directory/ as a folder and I have change /etc/apache2/sites-available/000-defaul-config to

DocumentRoot /var/www/html/wordpress Installation directory

and below in my .htaccess file

# 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

Any idea what is wrong?

4
Check permission for wordpress folder sudo chown www-data:www-data -R wordpress and sudo chmod -R 777 wordpressTamil Selvan C
i have given the above permissions. still not workingHitu Bansal
delete a .htaccess file once and then go to permalink and submit once againTamil Selvan C
i did it again. still not worked for me. it created a .htacess file again with same code as aboveHitu Bansal
Ok but dont create htaccess yourself, the htaccess is created when permalink is submitted. try onceTamil Selvan C

4 Answers

2
votes

Try https://codex.wordpress.org/Using_Permalinks#Fixing_Other_Issues

AllowOverride Not Enabled Your server may not have the AllowOverride directive enabled. If the AllowOverride directive is set to None in your Apache httpd.config file, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem. When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files. Example of enabled AllowOverride directive in httpd.config:

<Directory />
    Options FollowSymLinks
    AllowOverride All
 </Directory>

You may also have to enable the AllowOverride directive in your DocumentRoot:

<Directory /var/www/html>
    # ... other directives...
    AllowOverride All
 </Directory>

You may also have to change the AllowOverride settings for the site. This is surely the case when using Mac OS X Server, but might be likewise with other systems. Usually you can find the site configuration files in /etc/httpd/sites/ 

If you don't want to set AllowOverride to all (as it is above) then your AllowOverride list must include the FileInfo directive. You must restart your Apache server for any httpd.config file changes to take effect. For more information on which overrides are allowed, read about Apache Core Features. 
0
votes

Wordpress permalink fix

1.open phpmyadmin.

2.find your wordpress database.

3.Look for wp_options table.

4.Check first two fields and update option_value with your correct wordpress location.

5.Reload permalink.

0
votes

For people like me who had problems with permalinks with mod-rewrite enabled, AllowOverride All in the vhost and all good instuctions in the .htaccess.

I spent hours to find out that i put AllowOverride All in the vhost for the http ( :80 ) but not in the vhost for the https ( :443 ).

Hope this will save some time to you. =)

0
votes

WordPress permalink fix

  1. open phpMyAdmin.

  2. find your WordPress database.

  3. Look for wp_options table.

  4. Find permalink_structure set value to blank

  5. Suppress/comment modrewrite lines in your .htaccess if necessary Your WordPress is in plain permalink mode

In case modrewrite is not active and interactive setup doesn't work.