mod_rewrite redirect help (8 posts)

  1. duncmorley
    Posted 4 years ago #

    Hi there

    I have recently moved my wordpress blog to and all-in-one wordpress website. On my old blog the URL's were set up like this:


    Now on my new site the root of the blog is:


    and the articles are:


    I am looking for some help with my .htaccess file so that all traffic going to blog.domain.co.uk will go to the root of my blog (www.domain.co.uk/blog/) and everything else is just the domain changing from blog.domain.co.uk to the http://www.domain.co.uk.

    Hope this makes sense

    Thanks in advanced for any help with this.


  2. I would suggest making the root /blog and the articles /blog/2011.... because otherwise that gets messy. OR the root should be / (no blog).

    Put this ABOVE the WordPress section.

    RewriteCond %{HTTP_HOST} ^blog\.domain\.co\.uk
    RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [R=301,L]

    That should send everything

  3. duncmorley
    Posted 4 years ago #

    I would love to make everything http://www.domain.co.uk/blog/2011... but could not find out how to do that. Changing the permalink to /blog/%category% was not an option.

  4. How did you make the main blog http://www.domain.co.uk/blog/ then?

  5. duncmorley
    Posted 4 years ago #

    Created a page called "blog" and linked the post page to that.

  6. So you did this: http://codex.wordpress.org/Creating_a_Static_Front_Page

    Okay. What happens when you change the permalinks to /blog/%year%/%month%/%postname%

  7. duncmorley
    Posted 4 years ago #

    That works fine for the actual posts but then mucks with my custom post types.

  8. Well, this will redirect blog.domain.co.uk/whatever to domain.co.uk/whatever ... so that should cover most of it.

    RewriteCond %{HTTP_HOST} ^blog\.domain\.co\.uk
    RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [R=301,L]

    blog.domain.co.uk itself will go to domain.co.uk sadly.

Topic Closed

This topic has been closed to new replies.

About this Topic