问题
I am new to the world of web development. I have a website hosted. When I login it should take me to "member_dashboard.php"
. It redirects to this page on localhost. If I modify the localhost path, the remote redirect gets affected. I am using codeigniter as the framework. "base_url" is left blank. I tried setting the base url with the full http path of my index page still cannot fix it.
$config['base_url'] = '';
回答1:
Do this changes as well
In config/routes.php
$route['default_controller'] = "";//default controller name
$route['404_override'] = '';
In config/config.php
$config['base_url'] = '';
$config['index_page'] = '';
In config/autoload.php
$autoload['helper'] = array('url');
In .htaccess
(Place outside application
folder)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
回答2:
The value on this key must be different on each environment. It file can not be included on control version. Considerate set it on .gitignore
$config['base_url'] = '';
//localhost environment
$config['base_url'] = 'http://localhost/';
//other env
$config['base_url'] = 'http://mypublicsite.com/';
回答3:
Suppose your website name is example.com So just keep $config['base_url'] = 'http://example.com/'; under your application>config>config.php
Believe me your problem will solve because I personal did it and its working. Have any questions or clarification, please let me know.
Thanks, Amzad
来源:https://stackoverflow.com/questions/31284671/webpage-redirects-to-localhost