title: .htaccess RewriteRule for Flat Links
body: <p>I am pretty new to using the RewriteRule, so I am likely missing something obvious, but I have a PHP script that takes URL variables like this:</p>
  
  <pre><code>{baseurl}properties.php?prop=Property-Name
  </code></pre>
  
  <p>I would like to create RewriteRules so that anyone who types in this script name/variable combo would have their URL rewritten to:</p>
  
  <pre><code>{baseurl}/properties/Property-Name
  </code></pre>
  
  <p>As well as ensuring that anyone who types in the flat-link url, actually calls the script with the right variable name and value.</p>
  
  <p>I have been referring to <a href="http://corz.org/serv/tricks/htaccess2.php" rel="nofollow noreferrer">this link</a> and I have found related threads:</p>
  
  <p><a href="https://stackoverflow.com/questions/5660283/mod-rewrite-flat-links">Mod_rewrite flat links</a></p>
  
  <p><a href="https://stackoverflow.com/questions/4718652/mod-rewrite-trouble-want-to-direct-from-to-a-flat-link-nothing-seems-to-work">Mod_rewrite trouble: Want to direct from ?= to a flat link, nothing seems to work</a></p>
  
  <p>But, I am obviously doing something wrong, as I cannot get this URL to work the way I want. I am currently using the following code, which appears to do nothing (aside from rewriting the URL to include the www, and redirect requests for index.php to the site root):</p>
  
  <pre><code>RewriteEngine ON
  RewriteCond %{HTTP_HOST} ^baseurl.com$ [NC]
  RewriteRule ^(.*)$ http://www.baseurl.com/$1 [R=301,L]
  RewriteRule ^index.php / [R=301,L]
  RewriteRule ^properties/([0-9A-Za-z]+)/$ /properties.php?prop=$1
  </code></pre>
  
  <p>The issue is clearly with the last RewriteRule, assuming nothing above is affecting it. Again, I am likely doing something ridiculous. Can someone please explain what I am doing wrong?</p>
  
  <p>Thanks for your help.</p>