Problem with routes and mod-rewrite (if not absolute i don't get CSS, JS or images)

99封情书 提交于 2019-12-24 22:16:09

问题


i updated the code from my website to a 'better' veersion i think,

it works fine but when i try to implement the friendly URL and load it, works, but with no CSS, Javascript or images, but if i corret the routes for the css to http://website/css/style.css (instead of ./css/style.css) it i do see the CSS properly loaded,

any idea why?

Example: http://keepyourlinks.com/link1.php?id=25 VS http://keepyourlinks.com/keep/25/series-yonkis

(i updated the route of the CSS, but the Javascript is missing an the images asweell)

I really would like not to have to correct al routes :(


回答1:


./ means the current directory, which isn't where the file is, so it doesn't work.

Your best bet is to start using paths relative to the root of your site from now on, every time you write a link to a stylesheet or javascript or image, on every site. It always works and saves you from problems like this.

/css/style.css points to the same URL no matter what directory the current page is in.



来源:https://stackoverflow.com/questions/4910376/problem-with-routes-and-mod-rewrite-if-not-absolute-i-dont-get-css-js-or-imag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!