Answer the question
In order to leave comments, you need to log in
How to do a redirect correctly?
The problem is that the html comes in but is not replaced. The address also remains the same. Those. instead of a full redirect, we simply initiate a request.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php?route=$1 [L,QSA]
public function redirect($url) {
header('Location: ' . $url);
exit;
}
redirect('http://' . $_SERVER['HTTP_HOST'] . '/ViewCollection');
Answer the question
In order to leave comments, you need to log in
Could you describe in more detail what exactly you want to achieve? What does it mean to "replace the old code with the new one"?
Moreover, it looks like this (request - 302 empty response - the browser executes a get request at the address specified in the redirect - it receives the html code).It was you who described the normal operation of a 301 redirect. This is how it should work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question