M
M
Maxim Ivanov2015-08-22 22:57:33
htaccess
Maxim Ivanov, 2015-08-22 22:57:33

How to disable infinite redirect?

In my server settings

RewriteRule ^(.*\.css)$ http://%{HTTP_HOST}/site/$1 [R,L]

I would like it to redirect any css files to the given address.
http://domain/site/css/styleN.css
However, it turns out
http://domain/site/site/site/site/site/site/site/site/site/site/site/site/site/site/site/site/site/site/site/site/site/css/style.css

As a result, an endless redirect, how to stop it at the first stage? I read on Habré, but I didn’t understand
. If you make such a request
RewriteRule http://%{HTTP_HOST}/^(.*\.css)$ http://%{HTTP_HOST}/site/$1 [R,L]

That's some weirdness, doesn't redirect at all, directs to
domain/css/styleN.css

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Belyaev, 2015-08-23
@omaxphp

After applying Rewrite, the file is reopened with a new URL (changed), you need to make sure that the result with the changed URL does not fall under the replacement rule.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question