Forum Moderators: phranque

Message Too Old, No Replies

any mod_rewrite gurus out there?

total mod_rewrite noob needs advice

         

lbuenaventura

2:11 am on Jun 25, 2005 (gmt 0)



Hi guys ... i've been turning the entire left side of my body numb trying to learn Apache's mod_rewrite this evening and I was wondering if anyone might be able to help me. I'm building this ambitious little community site that needs some hardcore url rewriting, specifically, I need to turn urls like these ...

[domain.com...]

into these ...

[domain.com...]

Another example:
"http://www.domain.com/blogs/apple/article.php" becomes "http://www.domain.com/blogs/a/apple/article.php"
"http://www.domain.com/blogs/911" becomes "http://www.domain.com/blogs/0-9/911"

(Ok, i guess that last example is kinda a long shot.)

Anyway, that's it. I have only a very amateur grasp of regular expressions which is why I'm having such a hard time with this.

Any advice would be very much appreciated.

Thanks!

gergoe

7:28 pm on Jun 26, 2005 (gmt 0)

10+ Year Member



Take a look in the Apache URL Rewriting Guide [httpd.apache.org] for examples; there are some which will fit your needs for sure.

If you are not really into regular expressions yet, the I'd suggest you to find some resources about this subject, as it is very usefull - not only when dealing with apache, but much more when programing in any language.

jdMorgan

9:30 pm on Jul 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To generalize, it appears that you want to take the first character of the path that follows "blogs/" and rewrite to a subdirectory using that character as the subdirectory name.

If so, then it is a fairly simple rewrite, but defining the problem clearly is necessary before you jump into coding a solution.

Jim