CodeIgniter路径问题
我正在使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否尝试过将 css 文件夹添加到排除的重写条件中?
似乎没有排除文件夹 css 的重写(请参阅排除图像)。
尝试类似
祝你好运
Have you tried adding the css-folder to your excluded rewriteconditions?
Does not seem to exclude the folder css from rewriting (see images is excluded).
Try something like
Good luck
我认为问题出在您的 .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.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)