i当前使用Codeigniter
框架在Web应用中工作。它可以与Wampserver32
在本地运行良好,但是当将其传递到实时apache
服务器时,它仅加载主页,当我尝试路由到另一页时,它会出现:错误-404
我已经尝试更改:
1- $config['index_page'] = 'index.php';
to $config['index_page'] = 'index.php'?;
2-$config['uri_protocol'] = 'REQUEST_URI';
至$config['uri_protocol'] = 'PATH_INFO';
我实际上已经阻止了1天。
confing.php文件
...
$config['base_url'] = 'http://s661658794.onlinehome.fr/admin';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'PATH_INFO';
...
utaes.php文件
$route['default_controller'] = 'welcome';
$route['Admin'] = 'admin/Login';
$route['Login'] = 'admin/Login/dashboard';
$route['Home'] = 'admin/Home';
$route['Userinfo'] = 'admin/Usercontroller';
$route['History'] = 'admin/Historycontroller';
$route['Changepassword'] = 'admin/Changepassword';
$route['Notification'] = 'admin/Notification';
$route['Logout'] = 'admin/Login/logout';
$route['Forgotpassword'] = 'admin/Login/Forgotpassword';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
.htaccess文件
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 year"
</IfModule>
## EXPIRES CACHING ##
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
文件夹
-/
---admin
------application
------assets
------system
------user_guide
看起来您需要调整应用程序/config/database.php以匹配apache服务器数据库设置。
如果您的index.php文件位于public_html文件夹中的admin内部然后,您需要用以下代码替换它。
您的代码
重写
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
可能对您有用
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ admin/index.php?/$1 [L,QSA]