title: help using mod_rewrite on both dynamic and static URL's
body: <p>I looked at this topic: <a href="https://stackoverflow.com/questions/3317580/configuring-search-engine-friendly-url-mod-rewrite">configuring search engine friendly url (mod_rewrite)</a> and understand how the rewrite rules would apply, but need help understanding how to adopt them for websites that have static and dynamic URL's.</p>
  
  <p>From the topic above, the rewrite rules would first look for a file that existed in the URL, and deliver it. So that would cover my static pages.</p>
  
  <p>Question 1: would indexing be preserved (in other words, domain.com/foo would show domain.com/foo/index.php)?</p>
  
  <p>Question 2: is there a way to use a single template file with these static pages (so the static file is really only the content)? At the moment, my rewrite rules point all URL's to a main template file that looks for the requested file and then includes it.</p>
  
  <p>Moving on, the rewrite rules would redirect you to index.php for any URL's that didn't match the above rule. I assume that's where I'd want my code to determine if it's an actual URL for my site, and deliver the content accordingly.</p>
  
  <p>Question 3: redirecting to index.php isn't going to pass along any variables to process. If I used index.php?url=$1 would that account for both domain.com/hi and domain.com/hi/there?</p>
  
  <p>Question 4: what steps can I take to ensure the URL's processed are legitimate (and not xss attacks or anything like that)? Should I set up a separate table in my MySQL database that stores all the possible URL's along with the ID of the content? I assume that's how Wordpress works. Or, if not using MySQL, would I do this with a class, or array?</p>
  
  <p>I know it's a lot, thanks in advance for everyone's help!</p>