我刚刚设法路由到i got this solution之后的子文件夹中的控制器。在本地计算机上,一切正常。在主机上运行时,出现“ 404”错误消息。
我只是新手,不知道在哪里错过
这里有一些信息:
本地:Apache 2.4.34; PHP 5.6.38
主机:Apache 2.4.35; PHP 5.6.38本地地址:hris.localhost.co.id
实时地址:hris.sbmgrp.co.id
这是我的文件夹
- public html
|-- hris <-- **subdomain folder**
| |-- application
| | |-- controllers
| | | |-- user
| | | | |-- Auth.php
| | | | |-- Dashboard.php
| | | |-- Welcome.php
| | |-- core
| | |-- MY_Router.php
| |-- .htaccess
|-- helpdesk <-- other subdomain
| |-- .htaccess
|-- .htaccess.php
MY_Router.php与this相同。
.htaccess(hris)
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /hris/
# If your default controller is something other than 'welcome' you should probably change this.
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
SetEnvIfNoCase X-Forwarded-For .+ proxy=yes
SetEnvIfNoCase X-moz prefetch no_access=yes
# Block pre-fetch requests with X-moz headers.
RewriteCond %{ENV:no_access} yes
RewriteRule .* - [F,L]
# Fix for infinite redirect loops.
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
</IfModule>
.htaccess在public_html中
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
当我尝试设置$ router [default_controller] ='welcome'时,它可以正常工作。 如果还有其他问题,请通知我。感谢您的建议。