上传到服务器时路由不工作(CodeIgniter) [英] Routes not working when uploaded to server (CodeIgniter)
问题描述
我在CodeIgniter上创建了一个网站,一切都在XAMPP上正常工作。但是当我上传我的文件到服务器的路由停止工作。
这是我的路线。
$ route ['default_controller'] =onlinec;
$ route ['404_override'] ='';
$ route ['home'] ='serial / home /';
$ route ['done'] ='serial / done /';
$ route ['redeem'] ='序列/兑换/';
$ route ['printpage'] ='serial / printpage /';
$ route ['login'] ='serial / auth / login';
$ route ['logout'] ='serial / auth / logout';
这里是我的 .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>
在 http:/ *** / serial / home
我在找不到404网址错误
在 http:/ *** / serial /
I
现在只有 index.php
b
尝试了 $ config ['uri_protocol'] ='AUTO';
和我的 mod_rewrite
在 httpd.conf
中启用,任何人都可以帮助我。这是一个AWS Linux服务器。
尝试添加在htaccess中Rewritebase like:
RewriteEngine On
RewriteBase /
或
RewriteEngine On
RewriteBase / subfolder / subsubfolder /
并尝试设置
$ config ['base_url' ] like:
$ config ['base_url'] ='http://yourwebsite.com/';
而不是:
$ config ['base_url'] ='';
。
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.
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.
这篇关于上传到服务器时路由不工作(CodeIgniter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!