开发者

Cannot Access the CSS while developing in Ubuntu?

开发者 https://www.devze.com 2022-12-22 10:33 出处:网络
I am developing a web application using PHP and mysql.I was doing the intial development in a windows machine and now shifted to ubuntu ultimate edition.I installed apache/PHP/Mysql and configured the

I am developing a web application using PHP and mysql.I was doing the intial development in a windows machine and now shifted to ubuntu ultimate edition.I installed apache/PHP/Mysql and configured them. I placed my web folder in /var/www and when I give the URL in browser,I am not getting t开发者_开发百科he page with CSS.

Not Working:

href="./css/style.css"

Working:

href="style1.css"

Is there anyway where I can give a common url so that it works both in linux and windows.


If webroot is /var/www/sitename.com

and CSS lives in /var/www/sitename.com/css

always refer to it as /css/style.css, not ./css -- "/" is relative to the webroot not the file system. './css' will screw you up if you're at sitename.com/page/about


Try using the full path http://localhost/[the proper path eg. css/style.css] and if it still doesn't work it's a file problem.

Check if You put the file where You expect it to be and if yes - try in console: chmod 0755 style.css

because You might be getting 403 error not 404

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号