D
D
Dmitry2014-08-16 10:06:35
PHP
Dmitry, 2014-08-16 10:06:35

.htaccess how to set exception for folder with scripts?

Hello. When I made the rules for .htaccess, I stumbled at one point.
Here is my htaccess:

RewriteEngine on
RewriteBase /
RedirectMatch 403 /\..*$

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !.html$
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule (.+) $1/ [R=301,L]

RewriteRule . index.php

RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]

The server has a folder with its own scripts (in fact, a separate cms), located in site.ru/libs/,
I tried to substitute the RewriteCond %{REQUEST_URI} line before the RewriteRule (.+) $1/ [R=301,L] line! /libs , but, unfortunately, nothing came out anyway. Tell me how to make an exception for this folder? Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gracer, 2014-08-17
@dmitrydeco

RewriteEngine on
RewriteBase /
RedirectMatch 403 /\..*$

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !.html$
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_URI} !^/libs # <-------
RewriteRule (.+) $1/ [R=301,L]

RewriteCond %{REQUEST_URI} !^/libs # <-------
RewriteRule . index.php

RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]

Somehow it seems

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question