i have enabled pretty url in url manager & tried login with. When logs in successfully to my dashboard, i am getting problem w.r.t CSS & JS loading for that page as the path makes problem i have analyzed the problem in network problem the screen shots are below.



First screen shot is the image when i am trying login without enabling pretty UR...works fine How to fix this issue.
Second:This is the login page when i enabled pretty url & opened login view
Third: This is the third image when i logs in where the path issue occurs. the path to load css & JS differs & hence i am getting 404 error in network panel
It doesn't really have much to do with the fact that your urlManager is enabled, but rather how you are registering your assets.
You could just add the js and css files to your Asset Bundle e.g. /frontend/assets/AppAssets.php and make sure that your bundle is published in the layout file e.g. /frontend/views/layout/main.php view.
You could also just try:
$this->registerJsFile(Yii::$app->request->baseUrl.'/js/plugins/sparkline/jquery.sparkline.min.js');
Instead of
$this->registerJsFile('js/plugins/sparkline/jquery.sparkline.min.js');
which looks for the file relative to the url, that's why it's not working with the urlManager enabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With