Mudit Kumar
Mudit Kumar

Reputation: 60

Redirect URL to a Subdomain by .htaccess

I am trying to redirect a URL to a subdomain I am already redirecting form a old domain to a new domain Like http://abc.com to http://xyz.com by the below code

RewriteEngine on
Redirect 301 / http://xyz.com/

So my Url becomes http://xyz.com/blog/

Now I want to redirect http://abc.com/blog/ to http://blog.xyz.com

How can I do this

Upvotes: 0

Views: 159

Answers (1)

Jon Lin
Jon Lin

Reputation: 143956

You don't need to turn the rewrite engine on, as the Redirect directive is part of mod_alias. You can add the other redirect before the one that redirects to xyz.com:

Redirect 301 /blog/ http://blog.xyz.com/

Redirect 301 / http://xyz.com/

Upvotes: 1

Related Questions