首页 \ 问答 \ .htaccess如何在RewriteRule之前检查URI +文件扩展名是否存在(.htaccess How to check if URI + file extension doesn't exists before RewriteRule)

.htaccess如何在RewriteRule之前检查URI +文件扩展名是否存在(.htaccess How to check if URI + file extension doesn't exists before RewriteRule)

通过以下URL访问页面时:

/网页

我们如何通过htaccess检查以下文件是否存在

/pagename.htm

然后加载index.php如果没有?

这是我正在使用的:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

我尝试过这种变化,但没有运气:RewriteCond%{REQUEST_URI}!/。htm -f


When a page is accessed via an URL like this:

/pagename

How can we check if the following file exists via htaccess

/pagename.htm

And then load index.php if not?

Here's what I'm working with:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I've tried a variation of this but no luck: RewriteCond %{REQUEST_URI} !/.htm -f


原文:https://stackoverflow.com/questions/9244365
更新时间:2022-05-13 11:05

最满意答案

JPEG压缩是一种有损压缩。 事实上,你有不同的输出大小已经表明你有不同的压缩率。 因此,你不能期望相同的结果。

该标准没有规定任何量化精度。

涉及压缩的数学(如离散余弦变换)需要几个近似值。 例如,你将使用多少位数字作为Pi? 你如何近似余弦?...

所有这些事情可能会因不同的实现而有所不同,所以即使您具有相同的压缩率,也不保证获得相同的结果。

如果你对更多细节感兴趣,请阅读https://en.wikipedia.org/wiki/JPEG (和标准)。

所以除非你通过同一软件运行两个图像,否则你不可能得到你想要的。 即使在相同的软件中也可能有差异。


JPEG compression is a lossy compression. The fact that you have different output sizes already suggests that you have different compression rates. Therefor you cannot expect identical results.

The standard does not specify any quantization precision.

The maths involved in the compression (like the discrete cosine transform) require several approximations. For example how many digits will you use for Pi? How will you approximate cosine?...

All those things may differ between different implementations so even if you have the same compression rate you are not guaranteed to get identical results.

Read https://en.wikipedia.org/wiki/JPEG (and the standards) if you are interested in more details.

So unless you run both images through the same software it is unlikely that you will get what you want. Even in the same software there might be differences.

相关问答

更多
  • var qualityEncoder = Encoder.Quality; var quality = (long); var ratio = new EncoderParameter(qualityEncoder, quality ); var codecParams = new EncoderParameters(1); codecParams.Param[0] = ratio; var jpegCodecInfo =
  • 你可以使用image2 muxer: ffmpeg.exe -i -f image2 'img-%03d.bmp' You can use image2 muxer: ffmpeg.exe -i -f image2 'img-%03d.bmp'
  • 继上面的评论...... Caffe版本包括几种可以用ImageNet数据训练的流行模型。 这些模型的输入层采用一致的格式,通常是JPEG或LMDB。 接受一种格式的输入层对于不兼容的格式(例如BMP)无用。 如果要接受BMP输入,则必须指定或写入不同的输入层。 如果要在同一训练运行中同时接受JPEG和BMP,则必须为这两种格式设置单独的输入处理,以使它们成为兼容的形式。 Following on to my comment above ... The Caffe release includes seve ...
  • JPEG压缩是一种有损压缩。 事实上,你有不同的输出大小已经表明你有不同的压缩率。 因此,你不能期望相同的结果。 该标准没有规定任何量化精度。 涉及压缩的数学(如离散余弦变换)需要几个近似值。 例如,你将使用多少位数字作为Pi? 你如何近似余弦?... 所有这些事情可能会因不同的实现而有所不同,所以即使您具有相同的压缩率,也不保证获得相同的结果。 如果你对更多细节感兴趣,请阅读https://en.wikipedia.org/wiki/JPEG (和标准)。 所以除非你通过同一软件运行两个图像,否则你不可能 ...
  • 您将无法轻松获得iPhone上的bmp表示。 在Mac上的Cocoa中,它由NSBitmapImageRep类管理,并且非常简单,如下所述。 在较高的层次上,您需要将.jpg转换为NSBitmapImageRep对象,然后让框架为您处理转换: 一个。 将JPG图像转换为NSBitmapImageRep 湾 使用内置的NSBitmapImageRep方法以所需格式保存。 NSBitmapImageRep *origImage = [self documentAsBitmapImageRep:[NSURL fi ...
  • 我找到了解决方案。 如果我明确地输入imEncode的第三个参数(对于JPEG编码,这表示编码的质量,范围从0到100)而不是使用默认值(95),问题就会消失。 这可能是OpenCV.Net中的一个错误,但它也可能是OpenCV本身的一个错误。 I found the solution. If I explicitly enter the third parameter to imEncode (for JPEG encoding this indicates the quality of the enco ...
  • 好的,我按照Mark的提示编写了一个Python脚本(请参阅原始问题下的注释),手动创建一个带有4bpp的4级灰度BMP。 这种特定的BMP格式结构适用于WaveShare制造的4.3英寸电子纸显示模块。 规格可以在这里找到: http : //www.waveshare.com/wiki/4.3inch_e-Paper 以下是将原始图像传输到我的代码并保存结果的方法。 convert in.png -colorspace gray +matte -colors 4 -depth 2 -resize '80 ...
  • 抖动 好吧,今天我有一点时间,所以这里的结果。 您没有提供绘图仪调色板,因此我从您生成的图像中提取它,但您可以使用任何颜色。 抖动背后的想法很简单我们的感知在区域上集成颜色而不是单个像素,所以你必须使用一些颜色差异的累加器,而不是渲染的颜色和应该渲染的颜色,并将其添加到下一个像素...... 这样,该区域具有大致相同的颜色,但实际上仅使用离散数量的颜色。 如何更新此信息的形式可以将结果分支抖动区分为许多方法。 简单直截了当: 将颜色累加器重置为零 处理所有像素 对于每个像素,将其颜色添加到累加器 在调色板中 ...
  • currentBitmap在您的代码中为null 。 要么你没有复制它被分配了位图值的部分,或者它没有被分配。 如果你的代码有一部分缺失,请将它添加到你的问题中,如果没有,你的问题是你永远不会得到位图。 编辑 你永远不会启动currentBitmap 。 该文档声明提供的位图必须与Mat对象(您的houghLines )的大小相同,并且您的位图类型应为ARGB_8888或RGB_565 。 currentBitmap is null in your code. Either you didn't copy ...
  • 您可以使用优秀的Batik( http://xmlgraphics.apache.org/batik/ )lib来实现这一目标。 但是您需要按照以下步骤操作: 使用WMFTranscoder将WMF文件转换为SVG 使用JPGTranscoder将SVG转换为JGP WMF >> SVG >> JPG 以下是关于它的代码讨论: http : //www.coderanch.com/t/422868/java/java/converting-WMF-Windows-Meta-File You can use ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)