RewriteCond 替换问题

发布于 2024-10-09 07:21:53 字数 330 浏览 0 评论 0原文

我对 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 技术交流群。

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

发布评论

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

评论(1

凉城 2024-10-16 07:21:53

在这种情况下,您可能想要类似的东西
RewriteCond %{DOCUMENT_ROOT}/images/%1/%2 !-f

In that case, you probably want something like
RewriteCond %{DOCUMENT_ROOT}/images/%1/%2 !-f

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