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 (https://dfarq.homeip.net/article.php?story=20040902200759738) if it’s addressed as https://dfarq.homeip.net/article/20040902200759738.
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.
Just to clarify, I do have the module installed and enabled:
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
I wish it were as simple as me overlooking that. 🙁
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+
dcook32p@htcomp.net
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.
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.
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:
Note the base dirrective and that I found caret-slash didn’t ever match.
Comments are closed.