Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any negative impacts when using Mod-Rewrite?

Tags:

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.

like image 725
gregh Avatar asked Aug 25 '08 18:08

gregh


People also ask

What does Mod rewrite do?

mod_rewrite provides a flexible and powerful way to manipulate URLs using an unlimited number of rules. Each rule can have an unlimited number of attached rule conditions, to allow you to rewrite URL based on server variables, environment variables, HTTP headers, or time stamps.

What is the importance of rewrite module?

The term "mod_rewrite" refers to a module for the Apache web server, which “rewrites” or redirects requests to specified content. Basically, the module transforms incoming requests to a path in the web server's file system. This makes it possible to "rewrite" a URL.

Do I need RewriteEngine on?

Yes, RewriteEngine and RewriteBase have to be specified only once. Save this answer. Show activity on this post.

How do I check if a rewrite module is enabled?

Open any web browser browser and type following the URL, 'localhost/check. php'. It will display the PHP version details and Apache Configuration. In Apache Configuration, search for the Loaded Modules section, and there you will find all the modules that are enabled.


1 Answers

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.

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

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.

like image 101
Ryan Doherty Avatar answered Oct 13 '22 10:10

Ryan Doherty