How to re-write URL with .htaccess
<p>I am trying to re-write:</p>

<pre><code>news.php?q=Contact+form+with+attachment
</code></pre>

<p>to look like:</p>

<pre><code>news/Contact+form+with+attachment
</code></pre>

<p>my link looks like this</p>

<pre><code>&lt;a href="news/'.urlencode($row['title']).'"&gt;
</code></pre>

<p>and appears like this</p>

<pre><code>http://localhost/untitled/public_html/news/Contact+form+with+attachment
</code></pre>

<p>in my <code>news.php file</code>, I have this code at the top</p>

<pre><code>&lt;?php $id = urldecode($_GET['q'])
$id = preg_replace('#[^0-9a-zA-Z]#i','',$id);
     $query = "SELECT * FROM news WHERE title = :id" ?&gt;;
</code></pre>

<p>then in my .htaccess I wrote this</p>

<pre><code>RewriteRule ^news/([0-9a-zA-Z_%+-]+) news.php?q=$1 [NC,L]
</code></pre>

<p>But when I click on the link it doesn't work it shows an empty/blank page
please help thanks</p>