$mydomain = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
//  $_SERVER['HTTP_HOST']  will give you "www.kcubeinfotech.com" for me
// $_SERVER['PHP_SELF'] wil give you url after "www.kcubeinfotech.com" . for example you url = "www.kcubeinfotech.com/test/php" than it will return only "test/php/"
// now how to appy to css js and images
<link rel="stylesheet" type="text/css" href="<?php echo $_SERVER['HTTP_HOST'].'/css/style.css';?>">
<!-- www.kcubeinfotech.com/css/style.css -->
<script src="<?php echo $_SERVER['HTTP_HOST'].'js/script.js';?>"></script>
<!-- www.kcubeinfotech.com/js/script.js -->
<img src="<?php echo $_SERVER['HTTP_HOST'].'/images/test.png';?>" alt="test png">
<!-- www.kcubeinfotech.com/images/test.png -->


Recent Comments


Sign In To Leave a Comment

Type your Comment below and click to send comment

error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); }