Welcome Guest, Not a member yet? Register   Sign In
HELP:redirect function works on localhost, but not on live server

Ok, try using the PHP header function to redirect to some random website like Amazon or Yahoo. If that works but redirect to your own application don't work, that is strong evidence that the problem is in your Codeigniter configuration.

Let's go over the installation steps. On your local server and your live server, you have a web document root directory. If you're running Apache on your PC, that's called htdocs, and if you have the standard $5-8 dollar hosting, that's usually called public_html or var_www or something like that.

In your web document root, you create a directory with your application name. Suppose it's called eshop, so that your visitors can shop at http://www.example.com/eshop. Now you unzip your CodeIgniter_2.2.0.zip or whatever version into your eshop directory.

Now you have a directory tree like this
        + eshop:cheese:
            + index.php
            + application
            + system
            + license.txt
            + user_guide

In your eshop directory, you can delete license.txt and user_guide. Now you should add a file called .htaccess to your eshop directory. That file should contain:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

If you don't have this file, you will have to specify the index.php file in every URL. Instead of
http://www.example.com/eshop/products/list you would have to have

This may be why your redirects are not working. Can you otherwise navigate your application with no problem?

But anyway, continuing... now upload your actual application files, the ones in your local application directory, to the eshop/application directory. You should never change anything in eshop/system, but there are changes to configure in eshop/application/config. At least you will have to change files

and possibly

Regarding redirection, the issue is most likely in the routes.php file.

I hope this info helps you. Let us know how it goes. Good luck!:cheese:

P.S. Check out the new official Codeigniter forums at http://forum.codeigniter.com/

Messages In This Thread
HELP:redirect function works on localhost, but not on live server - by El Forum - 10-27-2014, 06:26 PM

Theme © iAndrew 2016 - Forum software by © MyBB