Welcome Guest, Not a member yet? Register   Sign In
How to set base URL?
#1

[eluser]01010011[/eluser]
Hi,

I extracted CI in XAMPP's htdocs and renamed the folder to app and changed the $config['base_url'] from "http://example.com/" to "http://localhost/app/" and saved it. I also successfully followed CI's tutorial for getting rid of index.php from the urls

I then followed the form_validation tutorial at http://ellislab.com/codeigniter/user-gui...ation.html, created the 3 .php files and placed them in the correct folders as specified by the tutorial. However, when I entered info into the form and clicked the submit button, my browser was directed to http://example.com/form (the page was supposed to be reloaded because I did not set the validation rules)

Why am I still redirected to http://example.com/form even though I changed the base_url?
#2

[eluser]Yorick Peterse[/eluser]
Could you provide us with a copy of your config.php file?
#3

[eluser]01010011[/eluser]
Thanks for your reply. I've attached the file
#4

[eluser]pickupman[/eluser]
Your config file seems fine. How are you opening the form tag?
Code:
<?php echo form_open('name_of_controller/form');?>

Try clearing your browsers cache. If you have just started using CI, I doubt you have the output class caching your view. When you view the source code, what is the action url for the form tag?
#5

[eluser]01010011[/eluser]
Thanks for your reply pickupman.

Wow, the very first thing I tried was to clear Chrome's cache (Ctl+Shift+Del) and it worked immediately.

Why does clearing the cache work?
#6

[eluser]pickupman[/eluser]
All modern browsers try and save all the pages you visit. When you visit the page again, rather than re-downloading the page again from the server, it is taken from your temp folder off your computer. This gives a lot faster response, and makes the web feel faster. Using caching all of the images, css sheets, and js scripts is beneficial, but when you are debugging a script it's a pain in the butt. Some sites add a php header tag, or html meta tag to force the page to be downloaded fresh each time from the server. (think nba.com for something like that has live scores updates.)
#7

[eluser]01010011[/eluser]
But I still don't understand why I was redirected to example.com/form. Is it that this old page was in cache and was constantly being retrieved instead of reloading the page as it should have in my case?
#8

[eluser]InsiteFX[/eluser]
did you set the system and application directories in index.php?

InsiteFX
#9

[eluser]01010011[/eluser]
[quote author="InsiteFX" date="1270961224"]did you set the system and application directories in index.php?
InsiteFX[/quote]

Thanks for your reply InsiteFX.

If I remember correctly, I don't think I changed anything in these directories. To confirm this, I looked in the index.php file that was at the root of my CI folder (renamed "app"), and located the SYSTEM FOLDER NAME and APPLICATION FOLDER NAME and found the following:
Quote:$system_folder = "system";
$application_folder = "application"

Ok, so that's the default settings, I did not change anything. The only folder I renamed was CodeIgnitor's folder, not any of the inner folders.

Do I still need to change something in index.php?
#10

[eluser]InsiteFX[/eluser]
Can you post the directory layout that you have?

app/
---/etc

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB