开发者

Which file structure would be most appropriate for codeigniter?

Hello there I am having some thoughts on my file structure in codeigniter.What I'm doing right now is creating a folder with the project I'm developing for and name it 开发者_如何转开发let's say "myProject" then I put my codeigiter folder inside that file.And then everything is done normally as by creating a class called myProject again on the controllers folder...

this structure works but it creates urls that are really ugly(for example in a local server): http://localhost/myBlog/CodeIgniter_1.7.2/index.php/myBlog

also it creates some issues with my root folder...so if I have a css folder in my root I should call it like that: "/myBlog/CodeIgniter_1.7.2/css/myBlogStyle.css"

and not like that: "css/myBlogStyle.css"

do you have any suggestions on which is the right way to work with codeigniter? thanks in advance


Just make your folder at the root level. Get rid of the CodeIgniter_1.7.2, you don't need that folder.

C:
  xampp (or whatever)
     www (or htdocs)
        myblog
           application
           system
           ...

For your css:

C:
  xampp (or whatever)
     www (or htdocs)
        myblog
           application
           system
           css (put your css scripts in a folder call css)
              default.css

Then to access it, just

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

To get rid of your "index.php" from your scripts, change/add a .htaccess file to the file like this. Just google a file of it and change the rewrite rule to:

RewriteRule ^(.*)$ /myblog/index.php?/$1 [L]

C:
  xampp (or whatever)
     www (or htdocs)
        myblog
           application
           system
           css (put your css scripts in a folder call css)
              default.css
           .htaccess 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜