Reputation: 368
I'm having a heck of a time configuring a 301 redirect in apache.
What I want is anything on old-domain.com to redirect to new-domain.com/notify/
I don't want pages redirected. Meaning if someone goes to old-domain.com/page/blah.html, when they're redirected, I just want them to go to a subdir on new-domain.com, such as new-domain.com/notify/.
My 301 in the current apache config looks like this:
Redirect 301 /page http://www.new-domain.com/notify/
Redirect 301 / http://www.new-domain.com/notify/
That doesn't work. With anything other than /page and /, 404 errors abound and it tried to redirect /page to http://www.new-domain.com/notify/page/
I'm wondering if a RewriteRule before the Redirect would help - just truncate all stuff that's not root. Thanks!
Upvotes: 0
Views: 545
Reputation: 131570
You can just use the RewriteRule
to do the redirect directly.
RewriteRule .* http://www.new-domain.com/notify/ [R=301]
This would go inside your <VirtualHost>
block for old-domain.com
.
Upvotes: 2