CodeIgniter Forums

Full Version: base_url does not work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am taking a CodeIgniter project (I am a newbe). What I did is to copy the entire site to another directory, let's say form http://example/project/ to http://example/proyect1/ Then, I have changed the base_url variable in application/config/config.php to the new base url but in the login page when I click the login button it does nothing. If I change the base_url variable I can login and it takes me to the original site. I would like to be able to login to the new site.

Thanks for your help,

Manuel
(05-08-2019, 03:27 PM)agenteel Wrote: [ -> ]Hello,

I am taking a CodeIgniter project (I am a newbe). What I did is to copy the entire site to another directory, let's say form http://example/project/ to http://example/proyect1/ Then, I have changed the base_url variable in application/config/config.php to the new base url but in the login page when I click the login button it does nothing. If I change the base_url variable I can login and it takes me to the original site. I would like to be able to login to the new site.

Thanks for your help,

Manuel

Hello !
I also recently did 2 applications in CI4 due to the lack of domain names, and this topic helped me:
Two apps

step 1)
I just cloned the repository on drive C:\{username}\path\to\domain\folder\example.com\

step 2)
Deleted everything that was there except the app, public, system, writable, and .env file folders.

I ended up with something like:
Example.com/
          /app/
          /public/
          /and so on...

step 3)
I took everything in the "example.com" folder except the "system" folder and transferred it to example.com/appOne/, I just cloned the "appOne" folder and renamed it to example.com/appTwo/ ... it turned out like this:

example.com/appOne/
         /app/
          /public/
          /and so on...
   AND
example.com/appTwo/
         /app/
          /public/
          /and so on...

step 4)
I just set up all the paths in
appOne/app/Config/Paths.php AND appTwo/app/Config/Paths.php
to the system folder that was found in example.com/systems/

and yes sorry for my english
Please, check the link that is used for redirecting the user after a successful login.
Does it point to the old url (hard coded)?
Also check the application/config/routes.php file.
The mere fact that you can reach the correct login page, indicates that the base_url() setting itself is working correctly.
(05-08-2019, 05:45 PM)Digital_Wolf Wrote: [ -> ]
(05-08-2019, 03:27 PM)agenteel Wrote: [ -> ]Hello,

I am taking a CodeIgniter project (I am a newbe). What I did is to copy the entire site to another directory, let's say form http://example/project/ to http://example/proyect1/ Then, I have changed the base_url variable in application/config/config.php to the new base url but in the login page when I click the login button it does nothing. If I change the base_url variable I can login and it takes me to the original site. I would like to be able to login to the new site.

Thanks for your help,

Manuel

Hello !
I also recently did 2 applications in CI4 due to the lack of domain names, and this topic helped me:
Two apps

step 1)
I just cloned the repository on drive C:\{username}\path\to\domain\folder\example.com\

step 2)
Deleted everything that was there except the app, public, system, writable, and .env file folders.

I ended up with something like:
Example.com/
          /app/
          /public/
          /and so on...

step 3)
I took everything in the "example.com" folder except the "system" folder and transferred it to example.com/appOne/, I just cloned the "appOne" folder and renamed it to example.com/appTwo/ ... it turned out like this:

example.com/appOne/
         /app/
          /public/
          /and so on...
   AND
example.com/appTwo/
         /app/
          /public/
          /and so on...

step 4)
I just set up all the paths in
appOne/app/Config/Paths.php AND appTwo/app/Config/Paths.php
to the system folder that was found in example.com/systems/

and yes sorry for my english

Hello, digital_Wolf,

Thanks for your answer, I have sorted out the problem, it was an error in the .haccess file.

Manuel
(05-08-2019, 11:03 PM)Wouter60 Wrote: [ -> ]Please, check the link that is used for redirecting the user after a successful login.
Does it point to the old url (hard coded)?
Also check the application/config/routes.php file.
The mere fact that you can reach the correct login page, indicates that the base_url() setting itself is working correctly.

Hello, Wouter60,

Thanks you very much for your reply. The problem is fixed, it was an error in the .htaccess file.