Answer the question
In order to leave comments, you need to log in
How to set up a redirect to a folder?
Good afternoon.
Happy holiday everyone!
I can’t solve the problem here, but I really need it :(
Input data:
1. There is a site, page caching is configured on it, cache files are html pages that are stored in the page-cache folder.
2. All requests that go to the root /, are first created in the cache and then the page is taken from page-
cache.For example, go here site.com/kiev, the page is automatically pulled from site.com/page-cache/kiev.html Everything is cool, everything works.However, if you type in browser line site.com/page-cache/kiev.html then this page is available :( But I would like it to automatically redirect to site.com/kiev For half a
day I can’t figure out how to set up a redirect. Please help
Answer the question
In order to leave comments, you need to log in
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^page-cache/(.*?)(\.html|$) http://site.com/$1 [R=301,L]
RewriteRule ^$ page-cache/pc__index__pc.html [L]
RewriteCond %{DOCUMENT_ROOT}/page-cache/$1.html -f
RewriteRule (.+) page-cache/$1.html [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question