K
K
Kostya007232017-02-10 20:42:28
htaccess
Kostya00723, 2017-02-10 20:42:28

How to set directory in htaccess?

Wrote RewriteEngine rules


RewriteRule ^jump.php jump.php [L,QSA]
RewriteRule ^(.*) index.php [L,QSA]

But the following happens:
when the page accesses one of the files (css, js ..),
then, according to the conditions, the request goes to the root of
the file
http://website/assets/js/underscore.map

does not connect to the site, because htaccess redirects the request from `assets` to index.php
how to write a condition so that requests containing /assets/ fall into assets?
And advise something to read to deal with htaccess)
Preferably something short and only to the point.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-02-13
@shambler81

1 is short and doesn't work. mod_rewrite works in a rather specific way.
2. what to read https://habrahabr.ru/company/sprinthost/blog/129560/
further, this rule does not make much sense, what did you want to do with it?
and this rule redirects all requests to index
A L - it doesn't work as you think.
As far as I understand, this is your attempt to create a cnc

RewriteCond %{REQUEST_FILENAME} !-f
#! - отрицание , не файл
  RewriteCond %{REQUEST_FILENAME} !-l
# и не линка
  RewriteCond %{REQUEST_FILENAME} !-d
#  и не директория 
  RewriteCond %{REQUEST_FILENAME} !(.*)\.(css\|js\|html)$  
#   это прям если исключать по маске 
RewriteRule ^(.*)$ /index.php [L,QSA]
# после  любое количества cond идет rule  конды создают условия рул выполняет,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question