使用Mod-Rewrite时是否有负面影响? [英] Any negative impacts when using Mod-Rewrite?

查看:64
本文介绍了使用Mod-Rewrite时是否有负面影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道mod-rewrite有很多积极的作用.但是有否定的东西吗?显然,如果您的规则写得不好,就会遇到问题.但是,如果您拥有大量站点并且经常使用mod-rewrite,它将对性能产生重大影响吗?我在Google上快速搜索了一些基准测试,但没有发现太多.

I know there are a lot of positive things mod-rewrite accomplishes. But are there any negative? Obviously if you have poorly written rules your going to have problems. But what if you have a high volume site and your constantly using mod-rewrite, is it going to have a significant impact on performance? I did a quick search for some benchmarks on Google and didn't find much.

推荐答案

我在每月获得数百万次/点击/次的网站上使用了mod_rewrite,而没有任何重大的性能问题.您必须知道根据您的规则首先应用哪些重写.

I've used mod_rewrite on sites that get millions/hits/month without any significant performance issues. You do have to know which rewrites get applied first depending on your rules.

使用mod_rewrite最有可能比使用您当前的语言解析URL更快.

Using mod_rewrite is most likely faster than parsing the URL with your current language.

如果您真的担心性能,请不要使用.htaccess文件,这些文件速度很慢.将所有重写规则放在Apache配置中,该配置在启动时仅读取一次.每次请求都会重新解析.htaccess文件,并重新解析父文件夹中的每个 .htaccess文件.

If you are really worried about performance, don't use .htaccess files, those are slow. Put all your rewrite rules in your Apache config, which is only read once on startup. .htaccess files get re-parsed on every request, along with every .htaccess file in parent folders.

这篇关于使用Mod-Rewrite时是否有负面影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆