title: .htaccess RewriteRule path to query string
body: <p>I am trying to achieve that a url like</p>
  
  <p>example.com/<strong>path1</strong> to example.com/index.php?p1=<strong>path1</strong></p>
  
  <p>example.com/<strong>path1</strong>/<strong>path2</strong> to example.com/index.php?p1=<strong>path1</strong>&amp;p2=<strong>path2</strong></p>
  
  <p>In my .htaccess I have:</p>
  
  <p><code>RewriteEngine On</code></p>
  
  <p><code>RewriteRule ^(.*)/(.*)$ /index.php?c=$1&amp;g=$2 [NC,L]</code></p>
  
  <p><code>RewriteRule ^([a-zA-Z0-9-_]+)$ /index.php?g=$1 [NC,L]</code></p>
  
  <p>It works well for the case where we have the example.com/<strong>path1</strong>/<strong>path2</strong> but for the the case example.com/<strong>path1</strong> only works if there is no dot in the url. For example, I want to example.com/mydomain.com working to example.com/index.php?g=domain.com but I am not able to make it working.</p>
  
  <p>Could you help me with this please?</p>