Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.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/8/.htaccess/5.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 如何使用CodeIgniter组织站点?_Php_.htaccess_Codeigniter - Fatal编程技术网

Php 如何使用CodeIgniter组织站点?

Php 如何使用CodeIgniter组织站点?,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,例如,我创建了下一个结构 application js css system Standart.htaccess拒绝访问js或css文件夹中的任何文件 RewriteEngine on RewriteCond $1 !^(index\.php|robots\.txt|img|styles|js) RewriteRule ^(.*)$ /index.php?/$1 [L] 您建议如何组织网站结构?我使用的文件结构与您的相同,但在.htaccess文件中没有考虑到它们,因此它可以正常工作。我的

例如,我创建了下一个结构

application
js
css 
system
Standart
.htaccess
拒绝访问
js
css
文件夹中的任何文件

RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|img|styles|js)
RewriteRule ^(.*)$ /index.php?/$1 [L]

您建议如何组织网站结构?

我使用的文件结构与您的相同,但在.htaccess文件中没有考虑到它们,因此它可以正常工作。我的.htaccess文件如下所示

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
我可以通过回显基本url,然后添加其他目录来实现。例如,对于css文件,它将是

href="<?php echo base_url()?>css/filename.css" 
href=“css/filename.css”

我也想知道如何最好地组织我的资产

当我开始使用CodeIgniter时,我读到任何特定于一个应用程序的内容都应该放在应用程序文件夹中,而与多个应用程序相关的内容应该放在系统文件夹中,所以我习惯将我的资产放在application/assets/

不久前,我读到一条建议,将您的资产放在根目录下的文件夹中

/css
/images
/js

在我目前的项目中,我决定采用后一种结构


我不太确定你关于.htaccess文件的问题是什么?

我想让你了解如何在CodeIgniter中组织控制器,我已经写了一篇博客文章,介绍了我的想法,以获得最佳实践方法。过来看:

你能发布不起作用的url吗?是AppnName/controller不工作吗?抱歉,我忘记添加脚本路径。谢谢你的帮助。这是两个问题合一:)如果可以的话,我也会把你的答案记为正确的。谢谢你的提示,我正在将文件移动到资产。
/assets/css
/assets/images
/assets/js