How to set up a redirect on the folder?

Good afternoon.
Happy holiday to all!

Can't solve a problem and really need :(

1. There is a website it is configured to cache pages, cache files the essence html pages which are stored in the folder page-cache.

2. All requests that go to the root /, first created in the cache and then the page is taken already with page-cache.

For example, go here automatically pulls the page from it's cool, it works. However, if you drive in the browser this page is available :( And I would like to machine redirectio on

Half a day can not figure out how to set up a redirect. Please help
April 19th 20 at 12:48
1 answer
April 19th 20 at 12:50
RewriteCond %{REQUEST_URI} "^/page-cache" [NC]
RewriteRule ^page-cache\/(.*)\.html$$1 [R=302,L]
Thank you.

Almost, but now it redirects only to home. And it is necessary to on or on - joe_Hackett commented on April 19th 20 at 12:53
@aubree_Lang, updated the answer. And redirects to home - in the root / ? What the rules are before you added it from the response? - palm commented on April 19th 20 at 12:56
@Maximo_Batz, Yes, the root.

Now it seems to work, but this error 5e9c27d70a5aa401279071.png

See, it is now inside .htaccess in the site root:

RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{DOCUMENT_ROOT}/page-cache/pc__index__pc.html -f
RewriteRule .? page-cache/pc__index__pc.html [L]
RewriteCond %{DOCUMENT_ROOT}/page-cache%{REQUEST_URI}.html f
RewriteRule . page-cache%{REQUEST_URI}.html [L]

RewriteCond %{REQUEST_URI} "^/page-cache" [NC]
RewriteRule ^page-cache\/(.*)\.html$ <a href="$1">$1</a> [R=302,L]
- joe_Hackett commented on April 19th 20 at 12:59

Find more questions by tags htaccessProcessing URL