S
S
SDmitriy22019-12-03 10:22:04
htaccess
SDmitriy2, 2019-12-03 10:22:04

.htaccess how to set exclusion for folder?

On the server is cmc bitrix. A separate xenforo forum engine is installed in the site.ru/forum/ folder.
How to exclude the influence of the general htaccess on site.ru/forum/
Here is the original htaccess:
Options -Indexes
ErrorDocument 404 /404.php
php_flag session.use_trans_sid off
#php_flag default_charset UTF-8
#php_value display_errors 1
php_flag session.use_trans_sid off
#php_flag default_charset UTF- 8
#php_value display_errors 1
php_value mbstring.func_overload 2
php_value mbstring.internal_encoding UTF-8
Options +FollowSymLinks
RewriteEngine On
# ASPRO_ROBOTS Serve robots.txt with robots.php only if the latter exists
RewriteCond %{REQUEST_FILENAME} robots.txt
RewriteCond %{DOCUMENT_ROOT}/robots.php -f
RewriteRule ^(.*)$ /robots.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization }]
DirectoryIndex index.php index.html
ExpiresActive on
ExpiresByType image/jpeg "access plus 3 day"
ExpiresByType image/gif "access plus 3 day"
ExpiresByType image/png "access plus 3 day"
ExpiresByType text/css "access plus 3 day "
ExpiresByType application/javascript "access plus 3 days"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2019-12-03
@shambler81

1. Put another .htaccess in a folder with a second engine ( .htaccess) supports nesting and works from the current directory and below.
2. in each rule, add an exclamation point exception, this is a negation
. For example, like this

RewriteCond %{REQUEST_FILENAME} robots.txt
RewriteCond %{DOCUMENT_ROOT}/robots.php -f
RewriteCond %{REQUEST_URI} !^/foru/.*$ [,NC]
RewriteRule ^(.*)$ /robots.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteCond %{REQUEST_URI} !^/foru/.*$ [,NC]
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

And so in each rule
3. add my standard .htaccess for Bitrix to the rules, it has a lot of useful things.
https://klondike-studio.ru/standards/standartnyy-h...

S
SDmitriy2, 2019-12-03
@SDmitriy2

Added rules.
https://yadi.sk/i/-Db17dt_6a2aRA
Server gives error
https://yadi.sk/i/-Db17dt_6a2aRA

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question