title: .htaccess rewrite rules changing dynamic url
body: <p>I am trying to make the url's better for my website for SEO purposes.</p>
  
  <p>Currently pages are displayed like this:</p>
  
  <pre><code>SITE/[number]-[page name].html
  </code></pre>
  
  <p>I would like to get the pages to display in a format like below.</p>
  
  <pre><code>example 1.
  SITE/[page name].html 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>example 2.
  SITE/[page name]-[number].html 
  </code></pre>
  
  <p>(I would prefer to leave the page number out if possible, like example 1 but if it must be included I would like it at the end of the url, like the second example above.)</p>
  
  <p>I have the following rule in the .htaccess file. </p>
  
  <pre><code>RewriteRule ^([0-9]+)-(.*)$ site_page.php?page=$1
  </code></pre>
  
  <p>My biggest problem is that I have tried many ways to get the rewrite to do what I need.
  I am a complete newbie when it comes to rewrite.</p>
  
  <p>I have changed the rewrite to the following with no joy.</p>
  
  <pre><code>RewriteRule ^(.*)-([0-9]+)$ site_page.php?page=$1
  RewriteRule ^(.*)-([0-9])$ site_page.php?page=$1
  RewriteRule ^(.*+)-([0-9]+)$ site_page.php?page=$1
  RewriteRule ^([.*]+)-([0-9]+)$ site_page.php?page=$1
  </code></pre>
  
  <p>The above that I have tried was to keep the page id number, I would preferably like to get rid of the numbers altogether.  </p>
  
  <p>I have the following Lines in the setting.php file that controls how the website creates the relevant links. And it displays them as I would like. But I get a 404 error because I think the rewrite rule is not displaying what I expected it to display.</p>
  
  <pre><code>// non seo url
  $setup_url['normal']['resource']     = "$url_base/site_page.php?page=[number]"; 
  
  // seo url
  $setup_url['seo']['resource']    = "$url_base/[number]-[name].html";
  </code></pre>
  
  <p>I have looked at so many articles on mod rewrite rules, and seem to be getting no where. Any help would be greatly appreciated.</p>
  
  <p>Many thanks.
  Mark.</p>