简体   繁体   English

除非目录名称以下划线开头,否则图像不会显示

[英]Images won't display unless directory name begins with underscore

I'm setting up a gallery. 我正在建立一个画廊。 Images are inside a directory called 'gallery' on my localhost. 图像位于本地主机上名为“ gallery”的目录内。 Same thing for for my host server (1and1). 对于我的主机服务器(1and1)也是如此。

So, the issue is that when the actual directory is named 'gallery' the images don't display. 因此,问题在于当实际目录命名为“ gallery”时,图像不会显示。 But, when I rename the directory with an underscore such as: _gallery the images display properly. 但是,当我使用下划线重命名目录时,例如:_gallery,图像会正确显示。

The code that is suppose to work is a simple straight-up html code, but no dice: 假定可以工作的代码是简单的简单html代码,但没有骰子:

<div class="client-gallery">
    <img src="gallery/picture-01.jpg" />
</div>

So, in order for it to display the images, I have to create the directory as "_gallery" and of course the code: 因此,为了使其显示图像,我必须将目录创建为“ _gallery”,当然还要创建代码:

<div class="client-gallery">
    <img src="_gallery/picture-01.jpg" />
</div>

I'm thinking it may be something to do with my Rewrites: 我认为这可能与我的重写有关:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^project-details/([a-zA-Z0-9-]+)/ project-details.php?pn=$1 [NC,L]
Rewriterule ^([a-zA-Z0-9-]+)/ $1.php [NC,L]
</IfModule>

I could just leave the directory as _gallery, but that doesn't let me know what the heck is going on with the file. 我可以将目录保留为_gallery,但这并不能让我知道该文件到底在发生什么。 Any help is greatly appreciated. 任何帮助是极大的赞赏。

The set up is your basic set up. 该设置是您的基本设置。 The files have a basic PHP include_once callers since I separated the header, footer, jscripts, etc. Other than that...it's straight forward and frustrating I'm having a brain fart and unable to figure it out. 这些文件具有基本的PHP include_once调用程序,因为我分离了页眉,页脚,jscripts等。除此之外……直截了当和令人沮丧的是,我脑子里放屁,无法弄清楚。

Thanks. 谢谢。

Well, it looks like moving the culprit line to be the first RewriteRule it fixed the issue with the directories. 好吧,看起来像把罪魁祸首移到了第一个RewriteRule上,它解决了目录问题。 Thank you everyone for helping me debug this issue! 谢谢大家帮助我调试此问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM