title: Creating SEO friendly urls using htaccess
body: <p>I am trying to rewrite the urls of a site, i should mention that the way index.php works now is getting the p (page) parameter and including the appropriate file.</p>
  
  <p>So requesting a page is like this:</p>
  
  <pre><code>www.domain.com/index.php?p=home
  www.domain.com/index.php?p=search
  www.domain.com/index.php?p=profile
  www.domain.com/index.php?p=contact
  </code></pre>
  
  <p>I found how to create a rewrite rule for this:</p>
  
  <pre><code>RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?p=$1
  </code></pre>
  
  <p>so now <strong>www.domain.com/home</strong> would give me the home page</p>
  
  <p>But i also need to have a friendly url for this</p>
  
  <pre><code>www.domain.com/index.php?p=profile&amp;id=20
  
  to
  
  www.domain.com/profile/20/profile-friendly-name
  
  or better
  
  www.domain.com/profile/profile-friendly-name
  </code></pre>
  
  <p>*The profile-friendly-name refers to a company name</p>
  
  <p>Requirements:</p>
  
  <ol>
  <li><p>To have friendly urls for all pages e.g. /home, /contact</p></li>
  <li><p>To have a particular friendly url for the profile page with the
  profile name in the url</p></li>
  </ol>
  
  <p>My questions:</p>
  
  <ol>
  <li><p>How can i add a profile-friendly-name to the url with the existing url format (index.php?p=profile&amp;id=20)?</p></li>
  <li><p>Can i only have a unique name there (without the id), like my last
  example?</p></li>
  <li><p>If i manage to do that, will i have to change ALL the existing urls
  within the site (links, urls to images, to files) to the friendly
  format?</p></li>
  <li><p>I noticed that after applying the first RewriteRule some css
  stylesheets and js are not included. What is wrong?</p></li>
  </ol>