I
I
Ivan Nikolaevich2015-04-10 21:25:32
Apache HTTP Server
Ivan Nikolaevich, 2015-04-10 21:25:32

How to get rid of cylical request in .htaccess and make CNC?

We have a page
site.com/?id=1&bla=2&blabla=3
There are tasks for it:
1. Make a pointwise CNC, while not touching the CNC mechanism of the system at all.
2. Make a redirect from the old url to the new one
We make the rule: the CNC works, the page is given as if located at site.com/mychpu And now we need to redirect from the old url to the new one...
RewriteRule ^mychpu$ /?id=1&bla=2&blabla=3 [L]

RewriteCond %{QUERY_STRING} ^id=1&bla=2&blabla=3$
RewriteRule ^.*$ http://site.com/mychpu [R=301,L]

And it turns out a cycle =(
How to make the rule not work in case of internal redirection?
PS There are suspicions that it can be done using the flag, but nothing happened after the shamanism. I understand what can be done, for example, by throwing a php file, and redirect from there. there is a wish to find the decision on pure htaccess.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-04-13
@ShamblerR

RewriteCond %{QUERY_STRING} ^id=1&bla=2&blabla=3$
RewriteCond %{REQUEST_FILENAME} !mychpu$
RewriteRule ^.*$ http://site.com/mychpu [R=301,L]

Apparently, to disable cycling, you need to disable it;)
In general, you didn’t write what exactly you have in the cycle, just don’t forget that you will need to exclude the result of the first cycle in the additional RewriteCond.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question