Skip to content
Advertisement

htacess redirecting to js & css files

This is my typical PHP MVC Structure:

JavaScript

This is my htaccess configuration:

JavaScript

Write now my all requests are going through index.php. In my project files, I am accessing my css & js files located in Resources folder like following:

JavaScript

This result in following error

JavaScript

I tried to add following Rewrite rule in htaccess configuration, but it doesn’t work:

JavaScript

I don’t want to change my folder structure, since the same CSS & JS resources are shared between multiple projects, and it’s easy to manage them from single location. I just want to reference them somehow.

I also don’t want to include the code in my project file, like : include('../Resources/my.css') in PHP, I don’t want this.

Please provide a solution to this. Thanks and Regards

Advertisement

Answer

Well, as other also have pointed out in comments and answers, this is NOT POSSIBLE. We can’t refer above or outside of our Project Root from client side scripting. We can do things from server side coding, but client-side code, not possible/

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement