A
A
Alexander Timofeev2018-09-20 10:46:05
htaccess
Alexander Timofeev, 2018-09-20 10:46:05

What's wrong with redirect in .htaccess?

Why when I redirect from the root folder to a specific page in .htaccess:
redirect 301 / http://site/news.php/
the page name is duplicated in the address bar

http://site/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/news.php/

And accordingly nothing opens. How to fix?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Letyagin, 2018-09-20
@JorryGo

redirect 301 ^/& http://site/news.php/
In your version, the redirect will always occur when there is a slash in the uri.
You need to specify the start-of-line (^) and end-of-line (&) marks

D
dodo512, 2018-09-20
@dodo512

RedirectMatch 301 ^/$ http://site/news.php/
Or
RewriteRule ^$ http://site/news.php/ [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question