Simple Problem

New to mod_rewrite? This is a good place to start.

Simple Problem

Postby freakyfrank » Thu Aug 13, 2009 12:10 pm

Hello Folks..

I have a problem which is quite simple, but i cant get it working right.
I've made following rule:

RewriteRule ^index.php$ index.php?id=1

now also index.php?id=2 gets redirected but i want that only "index.php" for itself gets redirected...

I need something like a "end of line" caracter. $ only sets the end of the search-string

Does anyone has a solution 4 this?
I already googled, but only found tutorials that covered other parts of the rewriting rules...

edit: No need 4 reply, solved the problem with php, thx
freakyfrank
 
Posts: 1
Joined: Thu Aug 13, 2009 11:58 am

Postby richardk » Fri Aug 14, 2009 1:26 pm

RewriteRules do not match query strings. To match query strings you must use the %{QUERY_STRING} variable and RewriteConds.

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STIRNG} ^$
RewriteRule ^index\.php$ /index.php?id=1 [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 34 guests

cron