Good all the time of day! I can’t figure out how to load style files / scripts / images using another URL.

I have simplified everything to the horror, so that it would be easier for you to explain what my fundamental policy is about ..

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -f RewriteRule .* aaa.css [L] 

This code should throw aaa.css from the root instead of any requested files .. but the browser gives me 404 errors all the time.

I suspected a bunch of errors, for example, like I forgot to set AllowOverride to All. if i try to change

 RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* aaa.css [L] 

then the redirect works with any request not for files, but just for any URL, it throws me on aaa.css file .. i.e. It's in RewriteCond% {REQUEST_FILENAME} -f Maybe I didn’t connect something necessary for these conditions to work or I just misunderstood the whole paradigm of htaccess

Explain at least which way to dig ... Thank you in advance for all the answers. any!

  • You wrote RewriteRule .* aaa.css [L] here RewriteRule .* aaa.css [L] that all requests should be processed via aaa.css but you should just ignore this aaa.css and the server will have to give it away. Those. just rename or delete htaccess. And the question is, what kind of result is needed? - Naumov
  • Try viewing the mod_rewrite logs: add the lines RewriteLog /var/log/rewrite.log and RewriteLogLevel 3 to your .htaccess path to your log file - Tunker
  • The final goal is that the files loaded from domain.ru/test/content/style.css are loaded from domain.ru/content/style.css, but I will write the regular schedule I need to deal with the situation described above in order to understand the whole picture. How to make so that when you request any file aaa.css is displayed? - Iam Opk

0