代码点火器路由问题
问题描述:
我设置了一个重写规则代码点火器路由问题
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
去除包括index.php文件的约束在我的网址,也我已经设置了以下
$config['base_url'] = '';
$config['index_page'] = '';
我的自定义路线
$route['test/(:num)'] = 'test/view';
我的挑战是我的默认页面的网址http://localhost:8080/skillmerce
工程,但每当我有一个网址形式http://localhost:8080/skillmerce/test/3
我收到一个404错误,除了我的路线更改为类似
$route['skillmerce/test/(:num)'] = 'test/view';
请我如何才能解决这个已经trried设置基本URL,但都无济于事
答
你的htaccess将
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|image|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
而且在config.php
$config['base_url'] = 'http://*.com/';
$config['index_page'] = ''; # leave this as empty
并在狂胜ES
$route['skillmerce/test/(:num)'] = 'test/$1'; # add $1 at the end
的问题是,我不想在路由添加skillmerce。这就是我想要删除,因为它目前与添加技能的工作,但我不希望它在我的路线,我想要的只是像$ route [test /(:num)] ='test/views –
@HordedoyinMatthewg添加路线这''route ['skillmerce/test /(:num)'] ='test/$ 1';' –
没有添加技能作为我的路由字符串的pathe没有办法吗? –