CodeIgniter路径问题

发布于 2024-12-23 15:23:46 字数 785 浏览 2 评论 0原文

我正在使用 Codeigniter 创建我的网站。这是一个巨大的网站,内容很多。

我对所有页面使用默认的欢迎控制器。

现在的路径是这样的 http://mydomain.com/index.php/welcome

我的文件夹结构是这样的

/root
  /codeigniter Application folder
      /controller
      /view
  /static/
      /images/
      /css/
      /pdf/
  .htaccess

,因为我先做内容,所以

现在当我使用重写删除“inde.php”和“时, 所有图像都设置为绝对补丁(http://mydomain.com/static/images/foldername/pc.jpg)欢迎”

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|system|pdf|sitemap\.xml|profile.htm|^([A-z,0-9,_,-]+).asp|(.*)\.pdf|phpadmin)
RewriteRule ^(.*)$ /index.php/welcome/$1 [L]

所有 css 和图像文件都是无法再访问。我有近千页的图片。我没有时间一页一页地更改。截止日期快到了,请帮忙。

谢谢

I am use Codeigniter to creat my site. it is a huge site with a lot of contents.

i use the default welcome controller for all pages.

the path is like this now
http://mydomain.com/index.php/welcome

and my folder structure is like this

/root
  /codeigniter Application folder
      /controller
      /view
  /static/
      /images/
      /css/
      /pdf/
  .htaccess

because i am doing the content first, so all the images are set to absolute patch (http://mydomain.com/static/images/foldername/pc.jpg)

now when i use the rewrite to remove "inde.php" and "welcome"

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|system|pdf|sitemap\.xml|profile.htm|^([A-z,0-9,_,-]+).asp|(.*)\.pdf|phpadmin)
RewriteRule ^(.*)$ /index.php/welcome/$1 [L]

all css and image file are not accessible anymore. I have nearly a thousand pages with images. I don't have the time to change the page one by one. the deadline is coming, please help.

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

轻许诺言 2024-12-30 15:23:46

您是否尝试过将 css 文件夹添加到排除的重写条件中?

RewriteCond $1 !^(index\.php|images|robots\.txt|system|pdf|sitemap\.xml|profile.htm|^([A-z,0-9,_,-]+).asp|(.*)\.pdf|phpadmin)

似乎没有排除文件夹 css 的重写(请参阅排除图像)。

尝试类似

RewriteCond $1 !^(index\.php|images|css|robots\.txt|system|pdf|sitemap\.xml|profile.htm|^([A-z,0-9,_,-]+).asp|(.*)\.pdf|phpadmin)

祝你好运

Have you tried adding the css-folder to your excluded rewriteconditions?

RewriteCond $1 !^(index\.php|images|robots\.txt|system|pdf|sitemap\.xml|profile.htm|^([A-z,0-9,_,-]+).asp|(.*)\.pdf|phpadmin)

Does not seem to exclude the folder css from rewriting (see images is excluded).

Try something like

RewriteCond $1 !^(index\.php|images|css|robots\.txt|system|pdf|sitemap\.xml|profile.htm|^([A-z,0-9,_,-]+).asp|(.*)\.pdf|phpadmin)

Good luck

吝吻 2024-12-30 15:23:46

我认为问题出在您的 .htaccess 文件上。我们有类似的设置,并且位于 application 目录之外的 url 可用,就像您拥有相对于其路径的直接 url 一样。查看 wiki http://codeigniter.com/wiki/mod_rewrite 了解正确的设置方法您的 .htaccess 文件。

编辑以澄清:网址 http://mydomain.com/static/images/foldername/pc.jpg 应该有效。您的 .htaccess 文件有问题。

I think the problem lies with your .htaccess file. We have a similar setup, and that url living outside of the application directory is available just as you have it with a direct url relative to its path. Check out the wiki at http://codeigniter.com/wiki/mod_rewrite for the correct way to set up your .htaccess file.

Edit to clarify: The url http://mydomain.com/static/images/foldername/pc.jpg should work. something about your .htaccess file is wrong.

云裳 2024-12-30 15:23:46

RewriteCond $1 !^(静态|index.php|images|robots.txt|system|pdf|sitemap.xml|profile.htm|^([Az,0-9,_,-]+ ).asp|(.*).pdf|phpadmin)

RewriteCond $1 !^(static|index.php|images|robots.txt|system|pdf|sitemap.xml|profile.htm|^([A-z,0-9,_,-]+).asp|(.*).pdf|phpadmin)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文