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.
HTTP 307 Temporary Redirect redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the Location headers. The method and the body of the original request are reused to perform the redirected request.
The best way to handle URL redirections is at the server level with HTTP 3xx redirect status code responses. If your site is down for maintenance or unavailable for other reasons, you can redirect it temporarily to another URL with a 307 Temporary Redirect response.
302 is temporary redirect, which is generated by the server whereas 307 is internal redirect response generated by the browser.
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-------------------------------^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With