Reputation: 26153
I've got what I considered to be a simple to fix issue where I want all the traffic from one subdomain redirected (301) to another subdomain (both on the same domain).
I've currently got this line in .htaccess
Redirect 301 news.domain.com blog.domain.com
but that throws a 500 error.
I'm totally lost with this and can't find any basic "this is how you redirect a to b" types of help. Everything I've looked at seems really convoluted and massively overkill for what I believe to be such a simple task.
Can someone help with this?
Upvotes: 0
Views: 152
Reputation: 143946
You can't match against the hostname/domain in the apache Redirect
directive, you'll have to match against the %{HTTP_HOST}
using a rewrite condition:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^news\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://blog.domain.com/$1 [L,R=301]
Upvotes: 1