Skip to content
Home » Apache » Any Unix gurus care to help me with mod_rewrite?

Any Unix gurus care to help me with mod_rewrite?

I’ve watched my search engine traffic decrease steadily for the past few months since I changed blogging software. It seems most engines don’t care much for the super-long arguments this software passes in its URLs.

The solution is mod_rewrite, and I think my syntax looks correct, but it’s not working for me.The goal is to fake out search engines to make them think they’re looking at static files. Search engines are reluctant to index database-driven sites for fear of overloading the site. Since I can’t tell them not to worry about it, I have to make the site look like a static site.

To that end, I created a section at the end of my httpd.conf file:

# rewrites for GL

RewriteEngine on
RewriteRule ^/article/([0-9]+)$ /article.php?id=$1 [NC,L]

This line should make the software respond to Thursday’s entry ( if it’s addressed as

Once mod_rewrite is working, in theory I can modify the software to generate its links using that format and watch the search engines take more of a liking to me again. But I’ve got to get mod_rewrite going first, and I’m stumped.

Any expert advice out there?

Thanks in advance.

If you found this post informative or helpful, please share it!

5 thoughts on “Any Unix gurus care to help me with mod_rewrite?”

  1. Just to clarify, I do have the module installed and enabled:

    LoadModule rewrite_module /usr/lib/apache/1.3/

    I wish it were as simple as me overlooking that. 🙁

  2. I don’t know too much about it, but the documentation says it should be ‘pattern’ and then ‘substitution’. Looks like you have it backwards… I don’t know about the rest of it.

    Dustin D. Cook, A+

  3. Try changing the param name to article.php in the substitution to “story” instead of “id”:

    RewriteRule ^/article/([0-9]+)$ /article.php?story?=$1 [NC,L]

    That might be the only problem. Your regular expression appears to be OK.

    1. Steve, a big thank you once again. I must have been thinking WordPress/b2 and not GL. I couldn’t tell you how long I’ve been staring at this, trying to figure it out.

    2. I recall having some trouble getting rewrite to work properly on my own servers to begin with. My working syntax translated to your example runs:

      RewriteEngine on
      RewriteBase "/"
      RewriteRule ^article/([0-9]+)$ article.php?id=$1 [NC,L]

      Note the base dirrective and that I found caret-slash didn’t ever match.

Comments are closed.

%d bloggers like this: