Answer the question
In order to leave comments, you need to log in
Redirecting all requests to a folder except certain ones?
Structure roughly:
/public
file.html
index.html
/scr
scr.php
/somedir
index.html
# В url
example.com/file.html
# На сервере подгружается
/public/file.html
# В url
example.com
# На сервере подгружается
/public/index.html
# В url
example.com/scr/scr.php
# На сервере подгружается
/scr/scr.php
Answer the question
In order to leave comments, you need to log in
I, who will face the same question in the future, catch
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/scr
RewriteCond %{DOCUMENT_ROOT}/public/$1/ !-d [NC]
RewriteRule ^((?!public/).*?)/?$ public/$1 [L,NC]
RewriteCond %{REQUEST_URI} !^/scr
RewriteCond %{DOCUMENT_ROOT}/public/$1 -d [NC]
RewriteRule ^((?!public/).+?)/?$ public/$1/ [L,NC]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question