Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.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
多应用程序代码点火器:删除;index.php/controller“;从URL_Php_.htaccess_Codeigniter_Codeigniter Routing - Fatal编程技术网

多应用程序代码点火器:删除;index.php/controller“;从URL

多应用程序代码点火器:删除;index.php/controller“;从URL,php,.htaccess,codeigniter,codeigniter-routing,Php,.htaccess,Codeigniter,Codeigniter Routing,我是CodeIgniter的新手,试图了解一些基础知识,也许还有一些高级方法来设置一个基于MVC的应用程序。过了一会儿,我想我可能会尝试设置一个管理面板,并创建第二个文件夹作为管理应用程序 这是我的文件夹结构: www.domain.com --frontend --admin 每个文件夹中都有一个应用程序集,其中包含自己的.htaccess文件。下面是管理员端的.htaccess文件 <IfModule mod_rewrite.c> RewriteEngine o

我是CodeIgniter的新手,试图了解一些基础知识,也许还有一些高级方法来设置一个基于MVC的应用程序。过了一会儿,我想我可能会尝试设置一个管理面板,并创建第二个文件夹作为管理应用程序

这是我的文件夹结构:

www.domain.com
    --frontend
    --admin
每个文件夹中都有一个应用程序集,其中包含自己的.htaccess文件。下面是管理员端的.htaccess文件

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /admin/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]    
</IfModule>

重新启动发动机
重写库/管理员/
1美元^(index.php | resources | robots.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L,QSA]
当前的工作url是
www.domain.com/admin/index.php/admin/posts
我试图毫无意义地将其更改为w
ww.domain.com/admin/posts
。那么如何从url中删除/index.php/admin呢

$config['base_url']
为每一方(管理员/前端)相应地设置,默认index.php也设置为空,
$config['index_page']=''

这是因为我有两个不同的应用程序还是因为配置不好? 在同一站点上使用多个应用程序的最佳实践是什么

希望我没有复制任何帖子,如果是这样,请不要恨我,并尝试帮助我。我非常感谢你们所有人。

试试这个

在config.php中

$config['base_url'] = '';
$config['index_page'] = '';
in.htacess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]
编辑01

<link href="<?php echo base_url(); ?>css/style.css" rel="stylesheet" />

我需要$config['base\u url']='';设置,因为我在视图中链接了css/js文件,并且给出的代码已经过测试,没有效果。谢谢你的回答。你需要加载css吗??所以加载CSS的问题??没有问题。我只想通过删除index.php/controller来改进应用程序。css是通过调用$config['base_url']加载的/css/style.css'。通过更改$config['base_url']我将无法获得css/js…我需要另一个解决方案,只需使用.htsccess或css路径修复工具即可。。。将无法返回任何内容,因此css/style.css不是有效路径。这就是我现在使用它的方式…示例
我有多少次不得不添加它的删除“index.php/controller”,而不仅仅是“index.php”。为什么人们连帖子都不看,就投了反对票。我已经尝试了一些来自那些帖子的修复,但都没有成功。。。