A
A
Alexey Ulyanov2019-02-06 19:07:18
htaccess
Alexey Ulyanov, 2019-02-06 19:07:18

Why is RewriteRule causing an unwanted redirect?

I want that when requesting the domen.ru/old/***/ page, the domen.ru/new/***/ page opens, but the url remains the same.
htaccess looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^old/([a-zA-Z]+)/$ https://%{HTTP_HOST}/new/$1/ [L]
</IfModule>
# 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

When opening pages like domen.ru/old/primer/, a 302 redirect occurs, which I don't need. Why?
5c5b06293f5e8707595830.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lamer350, 2019-02-06
@lamer350

[R=301,L] add at the end, it will be 301st
And regarding the topic itself, this is not real - htaccess redirects requests, if you want to open other pages - then you need to edit your php.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question