WordPress.org

Ready to get started?Download WordPress

Forums

Permalink woes (3 posts)

  1. trhaynes
    Member
    Posted 4 years ago #

    In short: I'd like my post URLs to have the category URLs as a base. For my blog, the category should be ("blog" is a category):

    site.com/blog (lists all blog posts, site.com/blog/page/2 is page 2)

    and the post should be:

    site.com/blog/55687/post-name-here

    Or, alternatively it could be something like site.com/content/blog and site.com/content/blog/5565/post-name-here. But it makes sense for users to be looking at the blog and then when they click an entry, they go deeper in and the URL base stays the same.

    Thanks for your help.

  2. Shane G.
    Member
    Posted 4 years ago #

    Hi,

    Set your desired wordpress permalink from admin area and add this code in htaccess of your blog;

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Thanks,

    Shane G.

  3. trhaynes
    Member
    Posted 4 years ago #

    Thanks for the reply, Shane. That code is already inside my .htaccess, and I don't see how it fixes my problem. Right now single pages are accessed as

    site.com/%category%/%postid%/%postname%, or site.com/blog/45676/my-post-name

    My category (like "blog") pages have to be at site.com/xxx/blog, where xxx is some identifier of my choosing.

    This above schema doesn't make sense to me and I don't want to impose it on my users, because site.com/blog/45676/my-post-name doesn't look like it's "inside" site.com/xxx/blog.

    Is there a way around what I'm explaining?

    I tried to change my post links to site.com/xxx/%category%/%postid%/%postname% and leave the category identifier as "xxx", and then rewrite site.com/blog to site.com/xxx/blog ... but the rewrite wasn't working. I removed the [L] from the WordPress rewrites so they don't stop.

    A secondary question, I guess, is where I can put my own rewrites and not have them conflict with WordPress'.

    Thanks!

    -tom

Topic Closed

This topic has been closed to new replies.

About this Topic