• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to redirect from CI index.php to folder/index.php?

#1
[eluser]qwertyjjj[/eluser]
I just loaded codeigniter.
How can I make a redirect in the index.php file to redirect all traffic to catalog/index.php?

#2
[eluser]amalik[/eluser]
Hey,
If you want to redirect your users directly to catalog class you can change it is your config/routes.php file by editing $route['default_controller'] = "catalog"; and that will load the index function from the catalog class. If you want to actually create a redirect because of any other reason you can use redirect('catalog'); and that will load your index function from your catalog class.

hope it helps.
amalik

#3
[eluser]qwertyjjj[/eluser]
[quote author="amalik" date="1329386464"]Hey,
If you want to redirect your users directly to catalog class you can change it is your config/routes.php file by editing $route['default_controller'] = "catalog"; and that will load the index function from the catalog class. If you want to actually create a redirect because of any other reason you can use redirect('catalog'); and that will load your index function from your catalog class.

hope it helps.
amalik[/quote]

Basically, I have OSCommerce installed. OSCOmmerce runs by loading the index.php file under the catalog folder.
I installed COdeIgniter because I want to use it alongside OSCOmmerce for some new functionality and jQuery.
ie there is no catalog class in OSCommerce.

#4
[eluser]InsiteFX[/eluser]
Code:
$route['catalog'] = 'catalog/index';

In Contoller
Code:
redirect('catalog/index', 'refresh');

#5
[eluser]porquero[/eluser]
You can use Multiple applications too:

http://ellislab.com/codeigniter/user-gui..._apps.html

#6
[eluser]qwertyjjj[/eluser]
[quote author="InsiteFX" date="1329392957"]
Code:
$route['catalog'] = 'catalog/index';

In Contoller
Code:
redirect('catalog/index', 'refresh');
[/quote]

Sorry, I'm a bit lost on that (I've read through tutorials but still a long way to go with learning)
The controller folder only has welcome.php and index.html.
Do I need to make an index.php controller and then an index.php view?

Where do I put $route['catalog'] = 'catalog/index'; is it application/config?
I changed welcome.php in the controllers to:

public function index()
{
redirect('catalog/index', 'refresh');
//$this->load->view('welcome_message');
}

but now I just get a blank page when going to http://localhost

...or am I supposed to put the entire OSCommerce application, stylesheets, and folders into the application folder?

#7
[eluser]porquero[/eluser]
Well, I see that you need known more CI.
I recomend you read the tutorial. It help you to understand CI.


http://ellislab.com/codeigniter/user-gui...index.html

#8
[eluser]qwertyjjj[/eluser]
[quote author="porquero" date="1329408020"]Well, I see that you need known more CI.
I recomend you read the tutorial. It help you to understand CI.


http://ellislab.com/codeigniter/user-gui...index.html[/quote]

I've read it but that doesn;t mean pratical experience of.
Is there a section on redirecting?
There's not really anything in the manual covering integration with existing sites.
The default controller is welcome.php so in the index function I put:
redirect('/catalog/', 'refresh');

However, that just shows a blank page at http://localhost
It should show localhost/catalog/index.php and that index.php page is not MVC it is OSCommerce code.

#9
[eluser]porquero[/eluser]
Are you sure?

Read Tutorial - Static pages: Routing

http://ellislab.com/codeigniter/user-gui...pages.html

#10
[eluser]qwertyjjj[/eluser]
[quote author="porquero" date="1329408480"]Are you sure?

Read Tutorial - Static pages: Routing

http://ellislab.com/codeigniter/user-gui...pages.html[/quote]

But all that means that I should set a controller called index.php with a function that has a redirect.
I then have a view called index.php but it essentially does nothing.
However, when I go to localhost/index.php I get a blank page
?

Should I be setting this in the routes.php file:
$route['default_controller'] = 'pages/view';

but make it

$route['default_controller'] = 'index.php';

Can the default controller not be a php page, does it have to be /somefolder/index ?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.