RewriteCond 替换问题
我对 Apache 中的 RewriteCond 有疑问。我有 URL myurl.com/cache/100x100/filename.jpg,我需要检查该文件是否存在。问题是,对我来说,这条确切的路径并不重要,重要的是不同的路径。我需要检查文件 /images/100x100/filename.jpg 是否存在。是否可以?现在我有:
RewriteCond %{REQUEST_URI} ^/cache/([0-9x]*)/(.*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
如何更改它以检查不同的文件?有没有类似替换之类的东西?
I'm havian a problem with RewriteCond in Apache. I have URL myurl.com/cache/100x100/filename.jpg and I need to check if the file exists. The problem is that for me is not important this exact path, but different one. I need to check if the file /images/100x100/filename.jpg exists. Is it possible? Right now I have:
RewriteCond %{REQUEST_URI} ^/cache/([0-9x]*)/(.*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
How can I change this to check different file? Is there anything like replace?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,您可能想要类似的东西
RewriteCond %{DOCUMENT_ROOT}/images/%1/%2 !-f
In that case, you probably want something like
RewriteCond %{DOCUMENT_ROOT}/images/%1/%2 !-f