How to convert static IP address to new domain name - codeigniter

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

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');

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

Allow URLs with Dashes on azure websites

I am trying to make an SEO friendly link for a downloads page
using codeigniter hosted on Azure Websites, now this is working:
www.example.com/downloads/viewfile/34
now when i generated this link :
www.example.com/downloads/viewfile/my-nice-file-name-34
the Url rewrite works great locally on a WAMP server, but when deployed to the remote (Azure Webites IIS ?) it gives the error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I believe that the cause is: dash symbols are not allowed on IIS but is there a way arround ?
After all, i found out that its not the dash symbols that are causing the problem, but the words in the url itself
like yesterday i had www.example.com/downloads/viewfile/example-file-34
to some reason, having your domain-name in the url segments makes that error apear, so i simply replaced "mydomain" into nothing before generating the Url segment
$fileName = str_replace('mydomain','',$fileName);
return url_title($fileName.$fileId);
Now the same link above is www.example.com/downloads/viewfile/file-34 and its working fine.
i also noticed that same behavior is experienced when using some words like : ajax, json.
I hope this would be helful to somone.
In your routes.php file
Find
$route['translate_uri_dashes'] = FALSE;
Replace with
$route['translate_uri_dashes'] = TRUE;
You may need to look also into
URI Routing Codeigniter 3
http://www.codeigniter.com/user_guide/general/routing.html
Codeigniter 2 URI Routing
http://www.codeigniter.com/userguide2/general/routing.html

codeigniter baseurl not working

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 ?

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