C
C
Caspanch2015-06-22 16:04:35
PHP
Caspanch, 2015-06-22 16:04:35

How to write redirects correctly?

There is a link like
view.php?id=107
This link used to have a page that is now located at
view/shampun_eva
Id of these records match, that is, I can find the url 107 of the record in the database and redirect
header("Location:/view/ shampoo_eva").
Is this the correct method?
Will it affect SEO?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2015-06-22
@IceJOKER

https://devaka.ru/articles/redirect-301

V
Vlad Zhivotnev, 2015-06-23
@inkvizitor68sl

I wonder why the task for the web server is solved using php?

map $arg_id $redirect_to {
107 /view/shampun_eva; 
108 /view/shampun_eva2;
109 /etc
default noredirect;
}

server { 
....
if ( $redirect_to != "noredirect" ) { return 301 $scheme://$http_host$redirecto ; }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question