我已经在网站上设置了一个无聊的环境,以便可以脱机工作。我已在流浪者文件中的PC上将端口80设置为转至8080,可以访问本地站点主页,确定为@“ http://192.168.1.10:8080”。
我的问题是路由不起作用,我在apache上启用了modrewrite并具有htaccess文件。我还编辑了config.php文件,但是当我尝试访问其他页面时仍然找不到404文件。我错过了明显的事情吗?
Config.php =
$root = "http://".$_SERVER['HTTP_HOST'];
$root .= dirname($_SERVER['SCRIPT_NAME']);
$config['base_url']= $root;
.htaccess =
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.well-known) [NC]
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{REQUEST_URI} !(\.well-known) [NC]
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
路线示例=
$route['default_controller'] = 'Home';
$route['customer'] = 'customer/login/login';
$route['products'] = 'Home/products'
我启用了mod relogging日志,我得到了它,就好像它只是传递了它所得到的一样:
[Sun Sep 02 08:34:32.836789 2018] [rewrite:trace2] [pid 15927]
mod_rewrite.c(476): [client 10.0.2.2:52113] 10.0.2.2 - -
[192.168.1.10/sid#7f71dfca45c8][rid#7f71dfc030a0/initial] init rewrite
engine with requested uri /products
[Sun Sep 02 08:34:32.836830 2018] [rewrite:trace1] [pid 15927]
mod_rewrite.c(476): [client 10.0.2.2:52113] 10.0.2.2 - -
[192.168.1.10/sid#7f71dfca45c8][rid#7f71dfc030a0/initial] pass through
/products