tags:

views:

27

answers:

2

i have a blog, and im moving it to a subdomain. since the URL sintaxis won't be the same, i just want to redirect all url requests that are inside /posts/ to the new subdomain:

from

domain.com/posts/xxxxx

to

blog.domain.com

this is what i have so far, but it still has to filter only the requests that are inside /posts/

RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://blog.domain.com/ [R=301,L]
+1  A: 

You're almost there. You just need to modify it so that your regular expression in the RewriteRule only matches stuff inside /posts/ as below:

RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^posts/(.*) http://blog.domain.com/ [R=301,L]
JGB146
thanks! @rfw posted sooner ;)
andufo
hi... it is not working. any of the solutions (which i believe are the same): http://andufo.com/posts/test
andufo
+1  A: 

The directives:

RewriteCond %{HTTP_HOST} ^domain.com
RewrietRule ^posts/(.*) http://blog.domain.com/ [R=301,L]

... should work.

rfw
is not working... pls try http://andufo.com/posts/test
andufo
nevermind... i was missing the AddType application/x-httpd-php5 .php RewriteEngine On
andufo