2
votes

On my WordPress installation, I have a blog living at http://domain.com/blog. Each individual blog post lives at http://domain.com/post-title.

So that I can more effectively segment page traffic in Google Analytics, I would like to revise my permalink structure so that individual posts live at http://domain.com/blog/post-title.

The challenge, however, is that I also have several pages at http://domain.com/page-title. I do not want to impact those page URLS.

Is there a way that I can modify the permalink structure only of my blog posts? If so, is it then possible to set a rule within .htaccess to redirect from old permalink structure to new?

1
Do you need to mess with your .htaccess file? Why not use an advanced filter in Google Analytics that will prepend /blog/ to your blog pages? This way you'll see what you want to see in GA without having to mess with your WP setup or .htaccess. - Andrew C

1 Answers

0
votes

I believe what you want to accomplish can be easily fixed by visiting the Settings > Permalinks page in wp-admin.

Towards the bottom of the permalink selection radio items, you can choose "Custom Structure", then enter a value like blog/%postname%/

This will have the effect of prepending all of your post slugs with 'blog', while leaving pages' URLs untouched.