D
D
Di Ma2019-06-06 14:47:12
htaccess
Di Ma, 2019-06-06 14:47:12

How to write a rule for htaccess?

Hello!
On the site, all requests are redirected to one file

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteRule ^(.*)$ ./index.php?path=$1 [L,QSA]

When we go, for example, to site.ru/foo, everything is fine. Styles and scripts are given to the browser normally.
But when we go, for example, to site.ru/blog/23432, an error occurs. Styles and scripts try to load at localhost/D:/xampp/htdocs/css/all.css?path=blog/cs...
How to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2019-06-06
@dimentimor

RewriteEngine On
RewriteBase / 
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php\?path\=$1 [L,QSA]

And so?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question