Same htaccess URL points to two different locations

With news.domain.com I’d like to have it redirect to www.domain.com/news which displays all the posts. I’ve got this working.

However when a user visits and old Tumblr to WordPress link like so:

Read More

news.domain.com/post/[ID]/[POST TITLE] I’d like to have it redirect to:

www.domain.com/[POST TITLE]

The problem I’m having is news.domain.com to www.domain.com/news is messing with the posts rewrite and pre-pending it to the URL like this: www.domain.com/news/[POST TITLE] which doesn’t work.

How do I set up htaccess to work for both scenarios?

Related posts

1 comment

  1. Try this :

    RewriteEngine on
    
    
    
    #Rule for /PostTitle
    RewriteCond %{HTTP_HOST} ^news. [NC]
    RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ http://domain.com/$3 [R,NC,L]
    
    
    #Rule  for /news
    RewriteCond %{HTTP_HOST} ^news. [NC]
    RewriteRule ^(.*)$ http://domain.com/news [R,NC,L]
    

Comments are closed.