Reputation: 157
I'm trying to redirect the traffic to my temporary adress. Im using httaccess file to do that. That's the content of it:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^old.domain$
RewriteRule (.*)$ http://new.domain/$1 [R=307, L]
It works if I enter adress: http://old.domain but it won't work with http://old.domain/somenting. It sends then 500 error. If I change R=307 to R=301 it works but I need 307 redirection.
Upvotes: 5
Views: 7229
Reputation: 1
RewriteEngine on
RewriteCond %{HTTP_HOST} old\.domain [NC]
RewriteRule ^/(.*)$ http://new.domain/$1 [R=307,L]
Upvotes: 0
Reputation: 143936
Those rules work fine for me, but there's a syntax error in your rewrite rule's flags. You can't have a space after the comma:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^old.domain$
RewriteRule (.*)$ http://new.domain/$1 [R=307,L]
# no space here-------------------------------^
Upvotes: 6