2

I have 40+ posts on my blog. Only one of them is going to a 404 page when I click the title (visit the permalink).

To see it in action: http://thegrovestead.com/tag/strawberries/

Look for the post "Cure for the common slug" and click the title (permalink: http://thegrovestead.com/cure-for-the-common-slug/)

You will get the 404 error. Note that all the other posts on that page will display the single post fine.

My htaccess is clean:

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

# END WordPress

I've disabled all the plugins. I've tried deleting and recreating the post, still getting the 404 error. If I modify the slug by one letter, it works. But the specific permalink above does not work.

There must be an explanation. Any advice?

  • it's strange indeed. you can try adding var_dump($wp_query); to your 404 template to get a clue as to why it's not finding the post, this will show you the SQL query being sent to the database and may provide a hint. also make sure the trash is empty for posts and pages, that's a long shot though. – Milo Jun 28 '14 at 4:32
  • Well it works now. Can you accept an answer or tell us what worked? – Andy Macaulay-Brook Aug 5 '16 at 21:06
  • disable any cache plugin you are using and then visit the settings->permalinks page. You don't need to press the save button. – Aamer Shahzad Mar 21 '18 at 11:39
1

It is not listed in the Codex but perhaps the word 'slug' in the pages URL is a reserved word? Just a wild guess and could be completely wrong. I thought it may be worth mentioning however as others may encounter a similar problem and might be the result of using reserved words.

If you reference the link to the WordPress Codex listed below, it states when using a reserved word in WordPres: "Doing so can cause WordPress to respond with a 404 error without any other hint or explanation."

For a complete list on words to avoid you can find these on the WordPress Codex. I believe this list is not 100% complete and there are a few other words but these are the bulk of them.

  • 1
    That's just for get or post var names, there are no reserved words in slugs. – Milo Jun 28 '14 at 13:35
  • 1
    There is one thing to look out for with slugs though - if you create one that's just a 4 digit number, it'll get picked up by the year rewrite rule and WordPress will try to load a year post archive. – Milo Jun 28 '14 at 15:30
  • Its not the word 'slug'. I tried several variations all with the word slug in them, and it works. Only the exact url above causes the error. There are no posts in the trash to delete, but its possible something is stuck in the database. For now, I have removed the 'the' from the slug and it works fine: thegrovestead.com/cure-for-common-slug Go figure. – thegrovestead Jun 28 '14 at 22:54
0

Turn off any caching plugins you are using and reload the page after clearing browser cache. Once fixed turn caching plugin back on and you should be fine. This worked for me a while back when i had this issue

0

Sometime it happens but on of the working solutions is to go to settings->permalinks and just hit save. it will flush rewrite rules and links will work again.

-1

apply rewrite mod command and restart server than change permalink's it's will work hope so.

  • Hi, can you please take a look at the help center to see how to write a good answer—that helps adding upvotes and therefore capabilities (like commenting) to your account? :) – kaiser Mar 18 '17 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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