I
I
ivanchik19862020-08-28 13:35:53
htaccess
ivanchik1986, 2020-08-28 13:35:53

How to defeat a circular redirect (htaccess)?

Good afternoon! Prompt with .htaccess and 301 redirect.
There is a page https://my.site/flowers.php I want to change the url to https://my.site/my-flowers
I write in htaccess:
RewriteRule ^my-flowers$ https://my.site/flowers.php [L]
And everything works well.
But I remember that now I need to put a 301 redirect from the past to the new URL!
And I add to htaccess:
RewriteRule ^flowers.php https://my.site/my-flowers [R=301,L]
After that, I get a cyclic redirect. And nothing works. And nothing helps

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dodo512, 2020-08-28
@dodo512

RewriteCond %{THE_REQUEST} ^\S+\s/flowers\.php
RewriteRule ^  https://my.site/my-flowers [R=301,L]

RewriteRule ^my-flowers$ /flowers.php [L]

Or
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^flowers\.php  https://my.site/my-flowers [R=301,L]

RewriteRule ^my-flowers$ /flowers.php [L]

D
Denis Ineshin, 2015-07-08
@IonDen

Chrome -> RMB on the element -> View element code -> the developer panel will open and all the styles applied to the element will be shown. Find one that overlaps with your style.

A
Alexander Zolotykh, 2015-07-08
@zolotykh

As geek01 wrote above , put !important, or check if it is already on the main class by default, if so, then it's better to find out why, if just like that, then it's better to remove it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question