1

This is my code below, i need to set a root directory for css files to access file from anywhere in application. But this is not working for getting images & css files.

define('ROOT', __DIR__);
define('RCSS', ROOT.'\css');
define('RIMAGES', ROOT.'\images');

And my Html Page Content is..

<link rel="stylesheet" type="text/css" href="<?php echo RCSS.'\master.css'; ?>"
Prem Kumar
  • 83
  • 1
  • 8
  • 1
    check the link: http://stackoverflow.com/questions/14192210/defining-the-document-root-directory-as-the-root-path – Suyog Nov 16 '15 at 05:39
  • Thanks @Suyog its now working and i have a small doubt now its working with (http://) if access from (https://) does it cause any problem???? – Prem Kumar Nov 16 '15 at 05:52
  • to clear your doubt, here is another link: http://stackoverflow.com/questions/4503135/php-get-site-url-protocol-http-vs-https – Suyog Nov 16 '15 at 05:57

1 Answers1

0

You are doing it in a wrong way. Try to use "http://" . $_SERVER['SERVER_NAME'] instead of __DIR__. Because you should pass web path to your html files.

slider_if
  • 276
  • 2
  • 10