How to fix ressources locations conflicts (CSS,JS,IMG) due to URL Rewriting and navbar links?

32 views Asked by At

Ok, there are already some topics about the general subject but I'm concerned by a situation I can't find in the already existing topics so sorry if I may have missed the exact same topic than the current one you're reading (if you have a link why not).

Situation : I did URL rewriting, all is good, when I enter in URL " mywebsite/general/home" it does the whole treating in my controller and includes view perfectly.
The thing is that in my navbar view, the href are in this form "general/home" and so, when I'm already on home page, if I click this nav link, the localhost server is looking for something like "mywebsite/general/home/general/home" (or even sometimes "mywebsite/general/general/home").
Consequently the nav links href are messed as the server think "general" and "home" are true physical folders.

I've tried many solution like <base href=""> or <base href="mywebsite/"> or <base href="/mywebsite"> or even <base href="http://localhost/fullpath/mywebsite/"> but it still doesn't work, messing with the URL arguments and ending up never finding ressources to display views correctly (or even basically navigation between pages).

Thanks a lot if you can be of any kind of help for this frustrating problem !

N.B. : Defining <base href="whateverinside"> is really problematic when it comes to href="#!" in navbar as I have some of these that when clicked on, they open dropdown menus and so because of this href base, the page refreshes even on fake links making dropdown menu unusable...

0

There are 0 answers