Is mod_rewrite a good/bad thing?

Is using MOD_REWRITE to create more user-friendly (and SEO-friendly) URL’s a good or bad thing?

How exactly does it work?

I’ve read up on it some in a book, but got confused what was going on…

TomTees

I don’t see how it would ever be considered a bad thing.

The rewrite module essentially allows you to explicitly design the URIs for your website.

e.g. You can turn this: “/index.php?query=val”. Into this: “/path/val”. (or vice versa if you’re looking at it from a “rewrite” perspective")

You need to first learn PCRE/PRE before you can begin to use rewrites. Rewrites are a bit hard to pick up even if you do know regex though. I’m sure there are some good tutorials out there, the [url=http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html]mod_rewrite documentation might be a good starting point though.

  • Because they might add unnecessary complexity to your webiste.

  • They might break your website if they aren’t done right

  • Maybe they slow your server to a grinding halt?!

The rewrite module essentially allows you to explicitly design the URIs for your website.

e.g. You can turn this: “/index.php?query=val”. Into this: “/path/val”. (or vice versa if you’re looking at it from a “rewrite” perspective")

But is the idea to go from…

/index.php?query=val

to

/path/val

Or is the goal to go from…

/path/val

to

/index.php?query=val

It is unclear what SEO’s are looking for?!

TomTees

  • Because they might add unnecessary complexity to your webiste.
  • They might break your website if they aren’t done right

  • Maybe they slow your server to a grinding halt?!
    All of these things would be the fault of the programmer for not using mod_rewrite properly. Designed and used properly, it’s fast and requires little or no maintenance. In most cases, all that happens is that everything is redirected to some server-side script, where then the URL is deconstructed and processed.

This. The idea is to get keywords into your urls - it’s especially useful in apps like wordpress. It’s much better to have an address of domain.com/postname than domain.com/index.php?p=3 - it’s just clearer what’s going on for people before they even arrive on the site. Don’t fixate on this too much for SEO purposes; it’s useful, but theres more important things to take care of first.

It’s also a lot nicer to look at :slight_smile:

Vanity URLs are for people not Search Engines. Make them as short and simple as possible. Do not throw a bunch of useless keyword stuffing crap in them. Short and simple. Search Engines could care less about your vanity URLs, the content is what matters to them.

I’d vote bad – at best a url rewrite is a layer of cruft for the application to cut through. Answer me this – how do you build your urls? Does this take into account the rewrites? If so, how?

What I prefer is to use url routing which is vastly superior. And most modern (non PHP) frameworks support this . . .

its a good thing period.

It is gr(a|e)y, neither good or bad. If you are stupid about it, it can be bad. But if you are smart about, well…