D
D
Denis Bukreev2015-11-13 09:39:08
htaccess
Denis Bukreev, 2015-11-13 09:39:08

How to make a redirect from the main page to the internal one?

Good afternoon
I can’t solve this simplest task.
It is necessary that there be a redirect from esk.ru to esk.ru/stati/ I
write the following code in .htaccess:
Redirect http://e-s-k.ru/ http://e-s-k.ru/stati/
but it just loops the redirect and displays such a beard: esk.ru/stati/stati/stati /stati/stati/stati/stati...
Actually, the site is on WP, there is generally a Rewrite registered there, is it possible to drive something there?

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

How to spell correctly?
Thanks

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman, 2015-11-13
@denisbookreev

Add the following to the top of your homepage template:

<?php
    wp_redirect( 'http://e-s-k.ru/stati/', $status );
    exit;
?>

$status is the status of the redirect, use 301, that 's it

D
Dim Boy, 2015-11-13
@twix007

Redirect 301 http://e-s-k.ru/ http://e-s-k.ru/stati/

or
Redirect 301 / http://e-s-k.ru/stati/

R
Ruslan, 2019-07-04
@DrealM

Подскажите, а как сделать такой редирект, только для авторизованных пользователей?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question