Routes not working when uploaded to server (CodeIg

2019-05-26 03:57发布

I created a site on CodeIgniter and everything works fine on XAMPP. But when I upload my file to the server the routes stopped working. I'm getting 404 URL not found error on all the page except the index page.

here is my routes.

$route['default_controller'] = "onlinec";
$route['404_override'] = '';
$route['home'] = 'serial/home/';
$route['done'] = 'serial/done/';
$route['redeem'] = 'serial/redeem/';
$route['printpage'] = 'serial/printpage/';
$route['login'] = 'serial/auth/login';
$route['logout'] = 'serial/auth/logout';

here is my .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

on http:/***/serial/home I get a 404 URL not found error

on http:/***/serial/ I get the page properly.

so only the index.php work at the moment

tried all possibilities on $config['uri_protocol'] = 'AUTO'; and my mod_rewrite is on in httpd.conf

can anyone help me out. This is a AWS Linux server.

1条回答
smile是对你的礼貌
2楼-- · 2019-05-26 04:47

Try to add in htaccess Rewritebase like :

RewriteEngine On

RewriteBase /

or

RewriteEngine On

RewriteBase /subfolder/subsubfolder/

and try to set

$config['base_url'] like:

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

instead of:

$config['base_url'] = '';

in your config file.

查看更多
登录 后发表回答