php - Different URLs when calling the base_url() function -
i have php file following content:
<script type="text/javascript" src="<?php echo base_url();?>js/example1.js"></script> <script type="text/javascript">var base_url = '<?php echo @base_url(); ?>';</script> ........ <input type="hidden" id="testvpn" value="<?php echo base_url(); ?>js/example.js"/> ........
when try open page locally, everything's ok:
<script type="text/javascript" src="http://example.com/js/example1.js"></script> <script type="text/javascript">var base_url = 'http://example.com/';</script> ........ <input type="hidden" id="testvpn" value="http://example.com/js/example.js"/> ........
when try open page on web vpn, want see:
<script type="text/javascript" src="https://mywebvpn.com/+csco+numbers++/js/example1.js"></script> <script type="text/javascript">var base_url = 'https://mywebvpn.com/+csco+numbers++/';</script> ........ <input type="hidden" id="testvpn" value="https://mywebvpn.com/+csco+numbers++/js/example.js"/> ........
but get:
<script type="text/javascript" src="https://mywebvpn.com/+csco+numbers++/js/example1.js"></script> <script type="text/javascript">var base_url = 'http://example.com/';</script> ........ <input type="hidden" id="testvpn" value="http://example.com/js/example.js"/> ........
p.s. framework - codeigniter. server side - php,mysql,apache.
p.p.s. configuring webvpn service not job. problem webvpn?
$config['base_url'] = ((isset($_server['https']) && $_server['https'] == "on") ? "https" : "http"); $config['base_url'] .= "://".$_server['http_host']; $config['base_url'] .=str_replace(basename($_server['script_name']),"",$_server['script_name']);
base_url()
returns site base url, specified in config file.
check if overwrite config data. if not caching, if miracle , it's return different values can do:
<?php $burl = base_url() ?> <script type="text/javascript" src="<?php echo $burl?>js/example1.js"></script> <script type="text/javascript">var base_url = '<?php echo $burl?>';</script> ........ <input type="hidden" id="testvpn" value="<?php echo $burl?>js/example.js"/>