Skip to content
Advertisement

My php rooter is routing my css/jpg… files

I got a homemade php rooter with an htaccess rewriting rule but my public files are always getting catched by the rooter after I leave my landing page, blocking thoses sources on my other pages.

index.php rooter :

JavaScript

My htaccess :

JavaScript

I should maybe change the htaccess ? but how ?

Thx

Advertisement

Answer

Your client-side resources should be referenced like this:

JavaScript

etc. So, note the prepended slash character (/) in the HTML attributes href and src. It references the location of the document root: /path/to/sample-mvc/public.

And, just as an example: here is the virtual host of my MVC-based app. Maybe it helps.

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