0

I have a self hosted WordPress blog and I've just discovered that when clicking on page 2 or "next" with the navigation at the bottom of the main homepage (showing the latest posts) I get a 404.

From what I can work out the URL isn't formed correctly for those buttons. It's doing:

https://example.com/adops/page/2/

Whereas I think it should be doing this:

https://example.com/adops/index.php/page/2/

The other questions I can find refer to custom post types that I don't believe I'm using unless something I have installed in terms of a theme or plugin has changed something. I only have a handful of seemingly simple plugins.

.htaccess from the subfolder contain the wordpress install contains:

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

# END WordPress

2 Answers 2

0

Are you using pretty permalinks? If so try to go to wp-admin > Settings > Permalinks and press the 'Save Settings' button.

The second form URL is only used when you dont have the Url rewriting enabled. But that is not recommend for SEO.

0

Are you running on a nginx server or Apache?

When WordPress run on Apache, as suggested by @hrk, when you select to use permalink, with mod_rewrite server directive, WordPress will automatically add the required rewrite rules to .htaccess file for permalinks to work.

But for Nginx, when WordPress detects that mod_rewrite is not loaded (which is the case with Nginx), it falls back to using PATHINFO permalinks, which inserts an extra ‘index.php’ in front. So choosing permalink alone will not solve the problem. The solution is: 1) pick any one of the permalink setting instead of the default "plain" setting from WP-Admin > Settings > Permalinks. 2) go to your virtual host configuration file (/etc/nginx/sites-available/default), find the the following directive and change it from:

try_files $uri $uri/ =404;

to

try_files $uri $uri/ /index.php?$args;

Remember to reload your nginx configuration after the change.

7
  • I'll be honest and say I'm not actually sure. I've got a cPanel style setup with wordpress installed through the "site software" part of that.
    – Gavin
    Jan 26, 2017 at 18:19
  • If that's the case, the easiest way is to contact your hosting company and show them this thread of msgs, and ask them how to fix it for you.
    – hcheung
    Jan 27, 2017 at 1:51
  • Did you try to follow what @hrk suggested? If it is Apache, your page will work once you set the Permalink unless .htacess is not writable, but in that case you should see an error msg. If it is not working, contact your hosting company or if you are familiar with FTP and command line, you can do it yourself as per what I suggested.
    – hcheung
    Jan 27, 2017 at 2:06
  • Thanks for your help so far @hcheung. I tried what hrk suggested and it appeared to have no effect. I then tried changing it to another option and it appears to have broken the site completely causing it to redirect back and forth between /"adops" and "/adops/" at the end. Putting it back hasn't fixed it. I'll add the contents of the .htaccess file to the question. It doesn't have a "try_files" line. Should I add it and if so where?
    – Gavin
    Jan 27, 2017 at 9:42
  • try_files is only applicable for Nginx server. and you have to add it to the nginx configuration file at /etc/nginx/sites-available/default file, see the details on this one. For apache server, Wordpress would automatically add the code to the .htacess file in your root directory. Take a look at this one. To find out whether your server is nginx or apache, run terminal command curl -I www.yourdomain.com, or let me know your domain name.
    – hcheung
    Jan 27, 2017 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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