简体   繁体   中英

CodeIgniter .htaccess rewrite not working on Live Server

I have a little problem with Code Igniter project, I have a .htaccess file to rewrite the index.php. It works great if I put my projects on Local Server. I am using WAMP Server. But now I have uploaded it on Live Server for example (godaddy,00webhost). And it is showing error : 404 Page Not Found.The page you requested was not found.

My .htaccess is here :

RewriteEngine on
RewriteBase /directory_name/
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favico​​n\.ico)   
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

and my config.php setting is here:

$config['base_url'] = 'http://example.com/directory/' ;
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

I have tried many solutions on web but not enough lucky to find one who helps me. I am stuck since 3 days. Anyone Help me.

If you are trying to host the website in a subfolder, make sure you enter the correct info in your htaccess and config:

Change RewriteBase /directory_name/ in htaccess to RewriteBase /ci_foam/

Change $config['base_url'] = 'http://example.com/directory/' in your config to $config['base_url'] = 'http://php0713061.herobo.com/ci_foam/'

You always need to make sure these values matches your current server setup.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM