【发布时间】:2015-04-29 09:28:52
【问题描述】:
我已经在公共 IP 上上传了工作的 codeignter 应用程序进行测试。 主页可以正常工作,但其他页面无法正常工作。
但我可以访问内部文件,如下所示: http://ip-address/index.php/about-us/who-we-are
我的文件如下:
**config.php**
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
**routes.php**
$route['about-us/(:any)'] = "page/aboutUs/$1";
$route['contact-us/(:any)'] = "page/contactus/$1";
$route['plan-articles'] = "page/planArticles";
$route['(:any)'] = "page/$1";
$route['default_controller'] = "page";
$route['404_override'] = '';
**.htacess**
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(index\.php|assets|fav\.ico|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
</IfModule>
【问题讨论】:
-
你是在根文件夹还是子文件夹?
-
在根文件夹上,但我可以以
http://ip-address/index.php/about-us/who-we-are访问内部文件 -
这是一个正确的链接吗?尝试将整个域放入您的 base_url
-
如果你从windows上传的问题可能是文件名大小写不同,你会收到404错误吗?
-
把这个
$route['about-us/(:any)'] = "page/aboutUs/$1";改成这个$route['about-us/(:any)'] = "page/index.php/aboutUs/$1";
标签: php codeigniter