codeigniter baseurl not working - codeigniter

I am using the baseurl() in my application. ex: "http://www.edocapp.in"
This is working in case if we type domain name with "www" but not working if I use "only http".
Application is hosted on server.

try
$config['base_url'] = 'http://www.edocapp.in';
this

Base URL should have / in the last char:
$config['base_url'] = 'http://www.edocapp.in/';
anyway, you should check your DNS record in your server/hosting.
Does it have an alias (CNAME Records) to redirect www.edocapp.in to edocapp.in ?

Related

Laravel URL Helper return IP address instead of Domain name

I have a problem when trying to create the Url using URL helper. I'm using Laravel 6.
$verify_url = url("/verify");
This is return the URL with the IP address instead of the domain name.
I don't know if it is a problem with the Apache server or the code.
Please help me. Thanks.
Adding this directive to Apache Virtual Host config seems to have fixed it: ProxyPreserveHost On
But a better way to use your urls is to name them in your routes/web.php. For ex:
Route::post('/verify', 'HomeController#verify')->name('verify');
and wherever you need to access to this url just use like this:
$verify_url = route('verify');

How change admin login url in Codeigniter 1?

Im using codeigniter 1 for a web system I want to change admin login url to my custom login url
current url - *http://siteUrl/admin/login*
Want to change - *http://siteUrl/adlogin*
How can I change this using config/router.php
thanks.
make route in config/routes.php
$route['siteUrl/adlogin']='controllername/methodname';
You can create routes for Your New URL Like :
URL:
application_url/application/config/routes.php
$route['adlogin'] = 'admin/login;
Please try this solution for your problem.
Use That on Route Without parameter Pass
$route['adlogin'] = 'admin/login';
With parameter Use This..
$route['adlogin/(:any)'] = 'admin/login/$1';

How to convert static IP address to new domain name

I have developed a website in codeigniter that has been hosted on a static ip address http://182.184.79.154.
Now I want to transfer all the urls of this website to a new domain http://integratedschoolsystem.com.
Can anyone help me how to do this ?
If I understand the question, you're trying to change the PHP application to address the links, not the DNS entry. In that case, assuming you followed Codeigniter's practices by using base_url() for all of your links, then all you have to do is update the config file.
\application\config\config.php
Line 26 (usually) is $config['base_url'] = '';
So set that to whatever your domain is, in this case:
$config['base_url'] = 'http://integratedschoolsystem.com';
https://www.codeigniter.com/userguide3/libraries/config.html

codeigniter base url and routes

I want to develop my codeigniter (v3) application at this address:
http://localhost/mycodeigniterApp/
I have :
$config['base_url'] = 'http://localhost/mycodeigniterApp/';
I get a 404 when I try to load any address in my applicaiton ( except for the default ).
Just closing this up the correct response was:
Couple checks make sure you class and file name of controller has
first letter upper case. Then check your routes.php

Https (SSL) in Codeigniter not working properly

I have a CI site with several form using jquery .click function, when I was in http its worked well, when I change to https all the form click button cannot be fire, its happen in localhost and in web host as well, is that anything need to config to run CI in https?
please advise and thanks!
Solved:
I just remove the url from $config['base_url'], and now the issue is solved, but I wonder how come when running https couldn't set value on $config['base_url']? hope someone would clear my doubt.
Thanks guy for taking time to view my question.
Set your base_url protocol independent:
$config['base_domain'] = 'yourdomain.com'; // a new config item if you need to get your domain name
if (isset($_SERVER['HTTP_HOST']))
{
$protocol = ($_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://');
$config['base_url'] = $protocol.$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
}
else
{
$config['base_url'] = '';
}
I am guessing your ajax request fails because you are trying to access no-secure content from a secure site.
I had a similar issue. I simply changed the base URL from HTTP to HTTPS in the config file and it worked well for both protocols.
# Base URL in codeigniter with HTTP
$config['base_url'] = 'http://mysite.abc/';
# Base URL in codeigniter with HTTPS
$config['base_url'] = 'https://mysite.abc/';
Remember, when you change HTTP to HTTPS, the site should work well for both protocols but it doesn't work the other way around.

Resources