Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 代码点火器清除URL_Php_Codeigniter_Mod Rewrite - Fatal编程技术网

Php 代码点火器清除URL

Php 代码点火器清除URL,php,codeigniter,mod-rewrite,Php,Codeigniter,Mod Rewrite,我正在处理这个URL。我正在做一个项目,我有这个URL: http://localhost/franca/menkenPh/index.php/controller/argument/argument 但我需要我变成这样: http://localhost/franca/menkenPh/0/cirug 我怎样才能做到 我尝试在.htaccess上执行此操作: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /franc

我正在处理这个URL。我正在做一个项目,我有这个URL:

http://localhost/franca/menkenPh/index.php/controller/argument/argument
但我需要我变成这样:

http://localhost/franca/menkenPh/0/cirug
我怎样才能做到

我尝试在.htaccess上执行此操作:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /franca/menkenph/
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
它告诉我,这些论点都被遗漏了


有什么线索吗?

转到应用程序/config/config.php从基本url中删除index.php

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = 'http://localhost/franca/menkenPh';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
然后转到您的路线添加

$route['/(:any)/(:num)'] = "maincontroller/index/$1/$2";
所以方法应该是index(),但根本没有参数,只需使用uri类并定位这两个uri段

$arg1 = $this->uri->segment(3,0);
$arg2 = $this->uri->segment(4,0);
你的重写库应该是

RewriteBase /franca/menkenph/

试试这个htaccess

很抱歉我没说,但我有这个路线:$route['site/(:any)]='site/index/$1';对不起,但是cirug是一个参数,我需要的URL是controller/argument/argument:)对不起,但是像什么?不,我认为mod rewrite不起作用。如果我这样做:它会转到主控制器,但如果我在该URL中添加了一些内容,我不知道它会去哪里,正在查找另一个控制器?我认为您必须将主控制器定义为默认控制器。如果您解决了这个问题,我们会遇到很多问题。请在中共享它,确保
mod\u rewrite
RewriteBase /franca/menkenph/
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /franca/menkenPh/index.php?/$1 [L]