Neil Page's picture

I have two Turnkey LAMP Stack OVA's - version 13 and version 14. I have a FRESH install of Wordpress, latest version on both VM's (Turnkey LAMP v. 13 & 14). Permalink %postname% works on version 13, but ont on version 14. Mod_rewrite is installed on both VM's. I'm stumped and can really use some advice.

These are fresh, vanilla installs of EVERYTHING. No special plugins, apache tweaks, nothing.

Permalink with default post number works on v. 14, but %postname% does not, which relies on mod_rewrite. The result is a HTTP 404 error on everying except the home page.

 

Thanks you,

Neil

Forum: 
Jeremy Davis's picture

You may have already done this but as you didn't mention it I'll say it anyway... mod_rewrite needs to be enabled; and Apache needs to be restarted for the new config to be applied...
a2enmod rewrite
service apache2 restart

Beyond that I'm not sure. Perhaps there is something that also needs to be enabled in WordPress?

Also the version of Apache in v13.0 is 2.2; whereas in v14.0 it's 2.4. There are some quite significant changes between these Apache versions, perhaps you need to make some config changes to your Apache vhost or .htaccess file(s)?

[Updated] Oops I just realised that you specifically mentioned "mod_redirect", not "mod_rewrite". I do not know of a mod_redirect, although there is a "Redirect" directive (that you can use in your vhost). Did you mean mod_rewrite?

Neil Page's picture

First of all, I've read many of your posts here Jeremy and I hope you know how grateful we are for your amazing contributions. You have helped more people than anyone could count. Thank you for everything.

Back to the problem:  I'm very sorry for my major typo - I meant "mod_rewrite". Yes I have enabled it on both v. 13 and v.14. On the v.13 VM it made WordPress fresh install work perfectly. On the v. 14 VM, it made no difference. It is as if mod_rewrite isn't really "on" even though the OS reports it is, and phpinfo() reports it is.

Here is why I'm looking at the TurnKey LAMP VM as the culprit:

1. Each VM is an absollute vanilla fresh install of TurnKey LAMP; on the same host. (one VM is v.13 and the other is v.14)

2. Each VM has an absolute vanilla fresh install of the latest WordPress. nothing additional installed (no plugins, no additional configurations, etc).

3. On each VM I enabled mod_rewrite:  (i.e. 

a2enmod rewrite
service apache2 restart

4. Each VM / OS / phpinfo() subsequently reported the mod_rewrite was "on".

5. On each VM / WordPress - I changed the permalinks from "Plain" (?p=123) - to "Post Name" (%postname%)

6. After the permalink change, v.13 works just fine while v.14 still does not; it still reports an "HTTP 404" error on every page except the home page. All evidence points to mod_rewrite failure - but I can't figure out why.

 

Thanks again

Jeremy Davis's picture

Are you using the same vhost in both? If so I reckon that's the issue (because of the changes between Apache 2.2 & 2.4), although I'm only only guessing really...

On the v14.0 appliance your WP Apache conf should look something like this.

Out of interest does the TurnKey v14.0 WordPress appliance work like it should for you? I'm guessing that it works like it's meant to as we've not had any reports of this issue (and it's one of our most popular downloads). Assuming that it does then you might be able to use that to help your troubleshooting efforts? If not then it's probably a bug that we need to fix!

Neil Page's picture

BINGO!

That was it:

AllowOverride All

That was what was missing from the vhost .conf.  I simply added that directive and restarted apache2 and it works now. I checked on the v.13 VM and that directive is there by default; but on v.14 it is omitted.

Thanks for posting the link to that GitHub file, and thanks for your help.

Neil

Jeremy Davis's picture

Glad you got it sorted. :)
Michael Norton's picture

I had a similar problem when upgrading from 13.0 to 14.1 Wordpress appliance.  Except everything worked great for the default Wordpress installation.  My problems started when I created a new virtual host for a sub-site and ran a default install of Wordpress on the new site.

I performed all the usual steps and even though my permalink structure did in fact change (like from /p=123? to /new-post/) Apache would still not serve the page (typical 404).  I found the problem by referring to the link above to the "wordpress.conf" file and noticed that when I created the new virtual host the new .conf file did not include the following:

<Directory /var/www/(yournewdirectory)>
    Options +FollowSymLinks
    Options -Indexes
    AllowOverride All
    order allow,deny
    allow from all
</Directory>


Copy/paste that section into your new vhost file, change the directory path to yours, save and retsart Apache.   All is once again right and well with the world!

Add new comment