How do I rewrite these URLs to draw dynamic content from my database

Discussion in 'Apache' started by Darden12, Oct 12, 2008.

  1. #1
    Can someone help me, please, to accomplish the following rewrite, either with htaccess or php, or a combination:

    Currently, I have a database of articles, each with its own URL-friendly article name stored in a variable called $FixedTitle. The dynamic URL used to view any particular article of mine is currently

    http://www.mydomain.com/article.html?FixedTitle=FIXED_TITLE_VARIABLE

    My goal is to have the appropriate article appear in one's browser when the reader keys in the following simplified URL

    http://www.mydomain.com/FixedTitle

    Any ideas?

    Thanks much. Let me know if I haven't explained this clearly. (I've been trying for two weeks to explain this requirement of mine to a freelance programmer, so far without success -- as he's so far just given me some ineffective redirects).
     
    Darden12, Oct 12, 2008 IP
  2. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Stick this rewrite rule in your Apache configuration or .htaccess file.
    RewriteRule (.*) http://www.mydomain.com/article.html?FixedTitle=$1 [L]
    Code (markup):
    If your freelance programmer has a rewrite rule similar to that but with an [R] at the end of it, tell him to remove the [R]. The [L] just means "Last" so if this rule matches then it won't bother looking at any more rules after that one.
     
    Ladadadada, Oct 14, 2008 IP