Answer the question
In order to leave comments, you need to log in
How to redirect from main to internal?
Good afternoon.
Please tell me how can I make a redirect from "/" to "/news" using PHP or NGINX, for example. At the same time, when visiting other pages, for example "/gallery", I would not be redirected to "/news".
Those. my main page is empty, I need it to be redirected to the module when visiting the main page.
How can this be implemented? Preferably with PHP.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
php.net/manual/ru/function.header.php
$path = parse_url($url, PHP_URL_PATH);
if (empty( $path ))
header('Location: http://www.example.com/news');
Guys, it takes longer to ask such questions than to google.
header( 'Location: google.ru/search?q=redirect ' );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question