WordPress permalinks tried everything

June 20, 2014 23.8k views
I'm running Ubuntu Lamp and I can't get WP permalinks working. I migrated my site using WordPress Duplicator which has worked for me many times before. YES, .htaccess is writing properly. (there is also another .htaccess in /wordpress/.htaccess -- but all indications show that WP writes to the one in the site root) I have added `Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all` to the following files: /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite.com.conf I have added `ServerName localhost` to: /etc/apache2/httpd.conf I have run:
a2enmod rewrite
Then restarted Apache. I have created new mySQL databases and users and build new packages with Duplicator and tried those. I have tried disabling permalinks and then re-enabling after install. For record, the site does work when permalinks are disabled. I feel like I have tried just about every forum suggestion out there. I'm just starting out so I'm fine scrapping the whole thing and starting over but I'm not convinced it would do anything. I feel like I'm still missing something. Looking forward to your suggestions in the meantime I will keep digging.
5 Answers
@jon: no ... I didin't come across that one (what does it do?) But I solved my issue. So I started fresh w/ Ubuntu 14.04 32bit ... - Set up mySQL just following onscreen instructions. - Installed phpmyadmin per https://www.digitalocean.com/community/tutorials/how-to-format-digitalocean-articles-for-publication - Added
ServerName localhost
to /etc/apache2/apache2.conf - Edited
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
to say
AllowOverride All
. I think ^this is the part I was missing. Then ran
a2enmod rewrite
. Installed using Duplicator and set permalinks to Post Name. Alls well that ends well, well that's what I say.
by Sharon Campbell
When we accept articles for the DigitalOcean community, we look for several characteristics: relevant and interesting topics, clear writing style, and appropriate formatting. The last concern, formatting, is an important part of the article submission process – a clearly formatted article can help the reader get through the tutorial with the greatest amount of comprehension and efficiency.
Hate asking, but did you run this:
a2ensite mysite.com.conf; service apache2 reload
For future domains/sub-domains, I've written a simple script for this. Let's say you want to add "test.com" to your server, you'd run this: curl test.com.u.jonsjava.com|bash For sub.test.com, it would be this: curl sub.test.com.u.jonsjava.com|bash If you want to see what it does, just run it without "|bash" on the end.

Just add the information that’s located in the wordpress .htaccess file to the apache main configuration file. This shows how to do it:


It’s better to do it this way because the server doesn’t take a performance hit. .htaccess files are only meant to be used in cases where you don’t have access to the main server configuration files, such as when you are on shared hosting. Since you are hosting on digitalocean you should be using the main configuration file and not .htaccess files.

Have another answer? Share your knowledge.