WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess for new install location (1 post)

  1. michaelphill
    Member
    Posted 2 years ago #

    We currently have a WordPress install at http://www.domain.com/blog.

    We are moving to having the WordPress install setup at the root level of the domain (www.domain.com).

    I've been tinkering with .htaccess rules to get anything under the http://www.domain.com/blog to 301 redirect to the same URL without the /blog part, but can't get it work right.

    For example: http://www.domain.com/blog/2012/06/24/post-name should redirect to http://www.domain.com/2012/06/24/post-name (notice the only difference is that the "/blog" part is removed).

    I would also need this to work for category, tag, archive, etc. pages as well.

    Another example: http://www.domain.com/blog/category/category-name should redirect to http://www.domain.com/category/category-name (again, just the "/blog" gets removed).

    I'm thinking the easiest way to accomplish this is to write a rule that simply rewrites any URL containing /blog right after the domain is rewritten (via a 301) to remove the "/blog" and keep everything else the same, but I'm honestly not very good at .htaccess rules. I think the other WordPress rules may be intefering.

    If anyone can let me know what rule(s) I need to add to .htaccess (and if it's above or below the WordPress stuff), I'd really appreciate it!

Topic Closed

This topic has been closed to new replies.

About this Topic