Take the 2-minute tour ×

Good Evening All,

I am having a little trouble with a .htaccess file that I was hoping some of you would be able to help me with. The first statement that we are rewriting (that rewrites my website so that the index.php is removed) - Statement One - functions perfectly so there are no issues with that, however when I try and remove the ?ID= from listing?ID=name it does not seem to want to work. The statement which for some reason does not function is attached in Statement Two.

Statement One

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !(index\.php)
RewriteRule .* index.php [L]

Statement Two

RewriteEngine on
RewriteRule ^listing/(.*) listing?ID=$1 [PT]

Any help that anyone would be able to offer would be greatly appreciated.


share|improve this question
Can you give a sample URL on how statement 2 is supposed to work? –  enchance Dec 13 '11 at 0:48
add comment

2 Answers

You don't need to to turn on the rewrite engine again.

share|improve this answer
No, you need to turn it on since there is a [L] in Statement 1. –  enchance Dec 12 '11 at 20:06
Thank you for the quick response. After removing "RewriteEngine on" the page still fails to render. Any other ideas? –  user1094456 Dec 12 '11 at 20:06
@enchance oops didn't see that! –  cgwebprojects Dec 12 '11 at 20:07
add comment

I'm not sure if I understand you correctly, but from your text I gather you want to turn listing?ID=123 into listing/123, right?

In that case you need the rewrite rule the other way round. This should work:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ID=(.+)
RewriteRule ^listing(.*) /listing/%1 [QSA]
share|improve this answer
add comment

Your Answer


