CodeIngiter base url not working on live server - php

i have a php codeignitor php app which was working fine on localserver xampp but when i uploaded that app on a live server, its not loading assets, images and also not submitting the login form. When see the source for login page, it shows urls like this
<link href="<?=base_url()?>assets/css/bootstrap.min.css" rel="stylesheet">
<link href="<?=base_url()?>assets/css/datepicker3.css" rel="stylesheet">
<link href="<?=base_url()?>assets/css/styles.css" rel="stylesheet">
also the form action shows like that
<form action="<?=base_url()?>auth/login" method="post">
i have tried every thing url helpers and all that stuff but still unable to fix it.

Sorry if is too obvious, but I assume that you have the url helper loaded in your autoload, right?

Related

Laravel 5.4 css files not showing and showing NotFoundHttpException

i have installed Laravel 5.4 in localhost. I'm using XAMPP to host the application. I'm using Laravel's inbuilt Blade template structure to show the data. I have used asset() helper to load my assets files which is inside the public folder. A sample code is here.
<link href="{{URL::asset('backend/vendors/bootstrap/dist/css/bootstrap.min.css')}}" rel="stylesheet" type="text/css">
But CSS file is not loading. I discovered this from Chrome developer tool's Network section. I have worked with Laravel before with it's other version and this is the first time that i'm working with version 5.4. Hope someone will assist me to solve this.
you can use only asset function like this i hope you have css folder inside public folder as mentioned in the path.
<link href="{{asset('backend/vendors/bootstrap/dist/css/bootstrap.min.css')}}" rel="stylesheet" type="text/css">
asset()
Generate a URL for an asset using the current scheme of the request (HTTP or HTTPS):
Ref: https://laravel.com/docs/5.4/helpers

CSS not working if i access localhost from Android

I want access my project from my android. I can access localhost server. But when i access the project
192.168.43.191/uajy
all CSS file cant load. I using codeigniter. I was call my css like <link href="<?php echo base_url() ?>assets/css/bootstrap.min.css" rel="stylesheet">
How to fix it?

laravel 5: external css won't import on shared hosting with SSL enabled

{I asked for this question before but didn't get a solution, so please try and understand..}
I am able to run my external javascript and css on my local machine, but I am unable to fetch the same on my shared hosting with go daddy (cannot afford dedicated)!
Although I could use the style and js if written internally...
I have tried a bunch of methods like:
<link href="{{asset('css/clock.css')}}" rel="stylesheet" media="all" />
OR:
<link href="{{URL::asset('css/clock.css')}}" rel="stylesheet" media="all" />
OR:
{{HTML::style('css/clock.css')}}
OR this one:
<link href="{{ url('css/clock.css')}}" rel="stylesheet" media="all" />
I installed laravel using this tutorial, which included in making of one more .htaccess file in www folder.
so how do i tackle this? please help!
Your #include statements in your CSS files that reference external stylesheets are what's throwing the error.
Simply don't use #import statements without https:// URL's. If you have to, then use something like a gulp task to fetch those and compile for you on the server side (although I still don't like this, and think it better to use package management like npm or bower).
If your domain is SSL protected your css and js has to be a "https".
To do so for external links(CDN links) make sure you are giving it like "https://link.com/test.css"..
And to add internal links from public folder
user
{{ asset('css/clock.css', true) }}
Here in asset true parameter adds https instead of http

Content Not Loading Via SSL

I have a banner in which the HTML is loaded into my file via:
<?php require("banner.php"); ?>
When I attempt to load my page via SSL (https://vantagewebservices.com/) the banner does not load. Chrome and FF are warning me that some of my scripts are not being loaded over SSL. However, the links in the HTML are all dynamic in the way that they are link via the root of my website and not by the domain. The banner.html file that is loaded into my index page can be found here: vantagewebservices.com/banner.html. If you can help me resolve this issue I would greatly appreciate it.
Some of your scripts are not loading via https, change the following lines to be protocol relative as mentioned by #Ennui below.
<link href='//fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
The main problem is that JQuery was not loading which your banner is dependent on.

Yii is not auto including jquery

I have a strange problem with Yii & Jquery:
When I open a page which uses ajax/jquery on localhost Yii does automatically add asset include calls to the of the page:
<link rel="stylesheet" type="text/css" href="/PATH/assets/f72b359d/style.css" />
<script type="text/javascript" src="/PATH/assets/2e442e1a/jquery.js"></script>
<script type="text/javascript" src="/PATH/assets/2e442e1a/jquery.cookie.js"></script>
However when I run same code on the server Yii does not do it hense no Jquery available.
I'd appreciate if someone could direct to a way to solve it.
It seems like you're not registering jQuery in the correct way. You must add the following line in /protected/views/layout/main.php before </head> tag:
<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
It will load jQuery automatically. Remember, if the YII_DEBUG flag is on it will load non-minified version, when deactivated (on production) it will load minified version. Hope this will fix your problem.
If all is working on your local machine it might be a permission problems
Have you checked that /assets is writable on your server ?
Yii publishes the assets it needs at runtime in this directory

Categories