Saya Bisa Karena Saya Berfikir Saya Bisa Karena Allah Ta'ala
I Can Because I Think Can Lillahi Ta'ala

How to fix base url in framework


We can set the base url or url in our framework to be automatically without change it wherever you want to place it in htdocs or localhost.

In CodeIgneter we will set it in application/config/config.php

Place this

$root = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

$config['base_url']    = "$root";

//$config[base_url] = "http://localhost/";

In Laravel we will set it in config/app.php

<?php
$root = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
return [
    'debug' => env('APP_DEBUG', false),
    //'url' => 'http://localhost',
      'url' => $root,
.......


So this is easy to fix all problem in your drive/ PC and your hosting wherever you want.

2 Responses to "How to fix base url in framework"

  1. Hi, for all time i used to check blog posts here early in the dawn, because i enjoy to learn more and more. capital one credit card login

    ReplyDelete
  2. Heya i'm for the primary time here. I found this board and I to find It truly useful & it helped me out much. I'm hoping to give something back and help others like you aided me. aol.com mail login sign

    ReplyDelete

Please Comment With Wise, Thank You!!!

Archive

Populer