• Resolved btemp

    (@btemp)


    Hi, love the plugin. Been a huge help.

    I’m trying to do a redirect on our blogs from site.com/post-title to site.com/blog/post-title.

    I’ve setup the regex ^/(?!blog)(.*) but this redirects EVERY post and page to /blog/.

    Is there a way to exclude all pages and only redirect posts? My permalink structure is /%postname% but my understanding is I need to convert this into PHP.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Godley

    (@johnny5)

    Unless the pages have a different URL structure there isn’t a way to do this.

    Thread Starter btemp

    (@btemp)

    Thanks for the response John. So given that my pages (site.com/contact-us) and my blog posts (site.com/save-money-on-taxes) are the same URL structure, there’s nothing to do? Too bad, but appreciate the response.

    Thread Starter btemp

    (@btemp)

    Part of why I ask is because through WordPress’ permalink structure I can change all my post permalinks (so change it do the %postname% or date, etc). But I can’t do this through any regex or other coding?

    I’m guessing the answer is just “no”.

    Plugin Author John Godley

    (@johnny5)

    Redirection works on URLs, not permalink structures. If there was a way to differentiate the posts and pages using the URL alone then it would be possible, but if you have them looking the same then it’s not possible. WordPress can do this because it makes additional database requests to look up the URL. This is not something Redirection is involved in.

    The best you can do is to redirect each post individually.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Redirect only Posts, not Pages’ is closed to new replies.