How can I fix my Wordpress Permalinks?

  • Posted on February 20, 2015
  • justjonAsked by justjon

One of my droplets got compromised and for some reason I cannot get permalinks working on the new droplet. I copied over all code and Apache settings, turned the permalinks off and back on in the WP admin, but the permalinks will not work.

I’ve tried everything I can think of. What do I need to do to get them working again? Thanks.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

On a new apache setup there are two common reasons that Wordpress permalinks would not be working.

1.) Make sure you have enabled mod_rewrite in apache. This can be done by running:

a2enmod rewrite

and then restarting apache

service apache2 restart

2.) Check your virtualhost configuration in /etc/apache2/sites-enabled/ and make sure that it is configured with AllowOverride All instead of the default AllowOverride None for your web root directory. This tells apache it is ok for settings in .htaccess files to override settings.

I had the same issue and after some research I found this solution:

Basically, you need to add the information that is found in the WordPress .htaccess file to the main apache configuration file. .htaccess files are only meant to be used in situations where you don’t have access to the main configuration file, like when you are using shared hosting.

If you’re using Digital Ocean you have access to the main configuration file, so you shouldn’t be using .htaccess files and you should have “AllowOveride None” set to increase apache performance.

I just went back and looked at your config file for your site and saw you have virtualhost defined twice…not sure why.

Perhaps simplify that a bit like something like:

<VirtualHost *:80>

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/

	<Directory /var/www/html/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
                Require all granted

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride All
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all

      CustomLog ${APACHELOGDIR}/XXX.log common
      ErrorLog ${APACHELOGDIR}/XXX-error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order deny,allow
        Allow from all


and finally, Maybe do (just to be sure) :

sudo chown -R www-data:www-data /var/www


sudo chmod -R 774 /var/www