Now that permalinks have been fixed-how best to go about changing the structure? (16 posts)

  1. eoren1
    Posted 4 years ago #

    I currently have my permalinks set up as day and name. Have posts going back to August 2010 with that structure. Now that 3.3 removes any performance penalties with use of categories in the permalink, is there a reliable method for changing without 404 errors or need for extensive 301 work?

    I have seen a number of plugins for this but most have fallen out of support or have a number of users reporting loopback errors. Would adding info in the htaccess be enough to fix this? Any possibility that WP will allow setup so that permalinks could be setup as 'past' and 'future' structure?


  2. In most cases, WordPress actually is smart enough to do that on it's own. But if you're concerned, tou'd be best served by doing it via .htaccess.

    RewriteRule ^([0-9]{2})/(.*)$ http://domain.com/$2 [L,R=301]

    That looks for anything that starts ##/POSTNAME and turns it into POSTNAME :) Put it above the START WORDPRESS line.

    Done and done.

  3. eoren1
    Posted 4 years ago #

    Thanks Ipstenu. Appreciate the help!
    My issue isn't so much WP internally, it's every FB page post and every incoming link I've managed to build up over the past 18 months. Plus a few internal links from one post to another.
    This is the rewrite rule I got from a site meant to generate such a redirect:
    RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://wednesdaysinmhd.com/$4

    However, that was to essentially change over from Day and Name to just Postname.
    Ideally I would like to change to:

    Would rules in the htaccess also serve to redirect links to specific posts with the Day and Name permalink structure to the new location?

    Thanks again!

  4. eoren1
    Posted 4 years ago #

    The town part is a fixed term by the way. I just realized that I chose a domain without a keyword I needed and was going to fix that by inserting the town name in the url as part of the permalink structure.

  5. Ah so your URLs were YYYY/MM/DD then :) (you said "I currently have my permalinks set up as day and name." so I assumed it was just DD/NAME)

    But yeah, that's what I do too.

    And if you want category/postname, just change the permalink to that, BUT keep the .htaccess redirect the way you did. WordPress will take domain.com/postname and on its own redirect you to the right place :) How cool is that?

  6. eoren1
    Posted 4 years ago #

    So I added the rewrite rule and updated the permalink structure
    However, when following a link on my Facebook page (which has the yyyy/mm/dd/name structure) or Google links to specific posts, I get a 404 error.
    Any suggestions?

  7. eoren1
    Posted 4 years ago #

    Also, internal links - such as when I manually inserted a link to another blog post in the text were also broken and led to a 404 page.

    I reverted back to the year/month/day permalink for now.

    Really hoping I can fix this though.

  8. Try this one:

    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://wednesdaysinmhd.com/$4 [L,R=301]

    Sometimes that works better than a Match.

  9. eoren1
    Posted 4 years ago #


    It is now sending me to domain.com/postname

    I need it to send me to domain.com/town/category/postname

    I have tried custom permalink as /%category%/%postname% with a optional category of Town

    And I've tried custom permalink as /town/%category%/%postname%

    If I type into the url bar after getting a 404 and manually add in the /town/category it works! Do I need to add those to the end of the rule?

  10. eoren1
    Posted 4 years ago #

    Not sure if it matters but I do use W3 Total Cache and CloudFlare

    I have emptied all caches after each step above

  11. Turn of w3tc while you're playing with this :)

    Try RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://wednesdaysinmhd.com/town/$4 [L,R=301]

    Set your permalink to /town/%category%/%postname%

    WordPress SHOULD go from domain.com/town/postname to domain.com/town/category/postname

    Though there's NO way to dynamically generate the category in the htaccess.

  12. eoren1
    Posted 4 years ago #

    Thanks for your help and patience with all of this!

    Turned off W3TC
    Used the new rule and permalink

    If I put in the category in permalink, external links broke. If I inserted the correct category into the url, it worked.

    Changed it to /town/%postname%/ which seemed fine until I followed a Google Tag link which broke because its url was domain.com/tag/--- and was missing /town/ before the /tag/

    I'm not sure why WP isn't correctly sending me to the address based on the permalink rules

    I have reverted back to Day and Name permalink structure for now (ie YYYY/MM/DD). By the way, I'm only doing this with the expectation that it will make a big difference in my SEO. If the url words are not strong elements in SEO, I'm happy to drop this.

    Thanks again,

  13. until I followed a Google Tag link which broke because its url was domain.com/tag/--- and was missing /town/ before the /tag/

    Hrm. Yeah, adding in /town/ is going to make it trickier. If you JUST went to domain.com/permalink, you'd be better off.

  14. eoren1
    Posted 4 years ago #

    Thanks Ipstenu.

    Not sure what domain/postname has to offer in comparison to domain/year/month/day/postname

    Ideally (and only for SEO purposes), I would like to have domain/town/category/postname. Potentially I could use town under the optional category base in the permalink settings though that doesn't seem to work regularly when i try it out.

    Not sure why WP isn't taking the domain/postname and following the set permalink rule to send that to domain/category base/category/postname

  15. I should explain this better.

    WP can take domain.com/postname/ and go to domain.com/categoryname/postname

    It can take domain.com/postname/ and go to domain.com/YYYY/postname/

    It CANNOT go to domain.com/BASE/anything/postname/

    That said? The SEO difference between domain.com/town/catname/postname and domain.com/postname are ... zilch. Zero. Zip. Nada.

    The HEO (human experience opt.) is minimal but a valid point.

    domain.com/postname is shorter and, thus, more likely to be remembered.

  16. eoren1
    Posted 4 years ago #

    Thanks. Without any SEO difference there really is no reason for me to keep pounding away at this. I'll just rest with my less than perfect choice of permalinks when I set up the site in August 2010 and let it go at that.

    I really do appreciate all of your help.


Topic Closed

This topic has been closed to new replies.

About this Topic