CodeIgniter Forums
Always redirect me to the home page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Always redirect me to the home page (/showthread.php?tid=66250)



Always redirect me to the home page - mirindraulki - 09-27-2016

Hi Every body thanks in advance for all for the help
I have a problem when i wish to change a pages.I finish the project and a send the project in a server online
When I want to go in a other page of the site, it redirect me automatically to the index of the main page, and when I want to go to other pages it redirect me again to the homepage
The project work in my local but online it has this problem

Thank you for all


RE: Always redirect me to the home page - createweb - 09-27-2016

Change your live config.php file

$config['base_url'] = 'http://www.yoursite.com';


RE: Always redirect me to the home page - InsiteFX - 09-27-2016

Did you change your base_url in ,/application/config/config.php to your new online site url?

Is you index.php pointing the application and system folder to the right path?

Check your config url protocol settings and your .htaccess file.


RE: Always redirect me to the home page - mirindraulki - 09-27-2016

- Yes , I change my base_url in config.php ,and it' ok in this party

- About my htaccess , here is the content of the file : 

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

- And for the index.php,I have not changed  anything since I installed codeigniter,we must change something in the index.php then

here are the content of the file 

$application_folder = 'application';


$system_path = 'system';

$view_folder = '';


RE: Always redirect me to the home page - mirindraulki - 09-27-2016

(09-27-2016, 04:04 AM)createweb Wrote: Change your live config.php file

$config['base_url'] = 'http://www.yoursite.com';

I have change it but it ' s not working

base_url = http://XXXXXXXX.com/Projet


RE: Always redirect me to the home page - createweb - 09-27-2016

(09-27-2016, 06:18 AM)mirindraulki Wrote:
(09-27-2016, 04:04 AM)createweb Wrote: Change your live config.php file

$config['base_url'] = 'http://www.yoursite.com';

I have change it but it ' s not working

base_url = http://XXXXXXXX.com/Projet

Use this .htaccess file

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

$config['index_page'] = 'index.php';

to

$config['index_page'] = ' ';


RE: Always redirect me to the home page - mirindraulki - 09-29-2016

Hi,

I ' ll show you myvonfiguration

application  > .htaccess 

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

I've tried to change this htaccess in many times but it's not working

for example : 

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

------------------------------------------------------------------------------------------------------------------------------------------
for the configuration 

- base_url = "http://xxxxxxxx.com/Projet"

- index_page = 'index.php'

in the route.php

$route['default_controller'] = 'HomeController';

it will redirect me automatickly in the function index of the controller, when i change the view in this index,the code work successfully but when i try to enter in other controller with a link or in a url,it' s not working,it redirect me forever in the homepage that i define in the function index

I think that it is a problem of htaccess but i don't know how 

Thanks a lot for every help


RE: Always redirect me to the home page - InsiteFX - 09-29-2016

You need to add the trailing slash to your base url:

PHP Code:
$config['base_url'] = "http://xxxxxxxx.com/Projet/"

You may need to change the .htaccess file to this:

Code:
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

You may also need to try a different URI protocol:

PHP Code:
$config['uri_protocol']    = 'REQUEST_URI'



RE: Always redirect me to the home page - mirindraulki - 10-03-2016

I ' ve try everytihng but it's not working guys


htaccess , base_url ,session,etc but i ' m always redirected in the controller where i defined in the route


RE: Always redirect me to the home page - InsiteFX - 10-03-2016

Post your directory structure of your online server here.