I have only pages, no posts as links. It's just a mock site at the moment.

I used a particular theme, set it to "Post name" permalink, and the links worked fine.

But then I changed to another theme (I think that's the only change I made), but the links don't seem to work anymore - it gives 404 errors.

Switching back to the first theme didn't help. Only Plain permalinks works.

This is on a Linode Ubuntu 12.04.5 LTS machine which has other Wordpress blogs running with a similar setup, but face no issue. Tried switching back and forth between the "Plain" and "Post name" mode - but no luck.

The httpd.conf looks like:

<VirtualHost *:80>
ServerAlias www.myexamplesite.com myexamplesite.com
DocumentRoot /var/www/myexamplesite.com
ServerName www.myexamplesite.com

<Directory /var/www/html/myexamplesite.com>
<IfModule mod_rewrite.c>
RewriteEngine On
AllowOverride ALL
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

</Directory>
</VirtualHost>
  • Do you see the server's 404 page, or a WordPress theme 404 page? – Milo Apr 26 '16 at 17:14
  • AllowOverride All should not be inside mod_rewrite AFAIK – bravokeyl Apr 26 '16 at 17:16
  • @Milo - the server's "Apache/2.2.22 (Ubuntu) Server" – siliconpi Apr 27 '16 at 7:30
  • Thanks @bravokeyl - tried that as well, but no dice! :/ I put it in <Directory> – siliconpi Apr 27 '16 at 7:31
  • Is mod_rewrite enabled ? ( i presume it is ) – bravokeyl Apr 27 '16 at 7:34

This is going to sound crazy, but the following worked... I put the content in the following directory:

/var/www/myexamplesite.com/public_html (and created log/ as well)

Along with the following entry in httpd.conf

<VirtualHost *:80>
ServerAlias www.myexamplesite.com myexamplesite.com
DocumentRoot /var/www/myexamplesite.com/public_html
ServerName www.myexamplesite.com

# Log file locations
LogLevel warn
ErrorLog  /var/www/myexamplesite.com/log/error.log
CustomLog /var/www/myexamplesite.com/log/access.log combined

<Directory /var/www/myexamplesite.com/public_html>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

</Directory>

</VirtualHost>

That's it!

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.