mod_rewrite and query string

should be rewrited into but the url I have to see in my browser is

and the same for : 

should be rewrited into
Who is Participating?

More Advanced - the Query String:

The query string is passed in separately from the URL. This means that a simple regex doesn't necessarily do the trick, but a compound statement using RewriteCond (condition) is required.

RewriteCond %{QUERY_STRING} id=([^&;]*)
RewriteRule ^/$ http://%{SERVER_NAME}/%1/? [R]
RewriteRule ^/([^/]*)/?$ /index.php?id=$1 [L]

The RewriteCondition matches only when the following condition is true, and continues until a "last" [L] is stated. The Condition's backreferences are different, using the % prefix, and their scope lasts beyond the Condition line.

This above example would translate "/?id=home" into "/home/", and then re-assign the value of "home" to the id HTTP_GET_VAR. One more thing to notice here is that the the second line has a trailing ? - this is used to negate copying of the query string into the new, re-directed URI.

More Reference Links:

So you're planning to use the RewriteRules in a .htacccess file? Or in httpd.conf?

That would be for a .htaccess file:

RewriteEngine on
RewriteRule ^gallery/([^/]+)/index\.html$ /index.php?gallery=$1 [L]
RewriteRule ^gallery/([^/]+)/([0-9]+)/index\.html$ /index.php?gallery=$1&img=$2 [L]

for httpd.conf, just add a leading slash in the pattern:

RewriteEngine on
RewriteRule ^/gallery/([^/]+)/index\.html$ /index.php?gallery=$1 [L]
RewriteRule ^/gallery/([^/]+)/([0-9]+)/index\.html$ /index.php?gallery=$1&img=$2 [L]
us111Author Commented:
>>>it is now classified as abandoned
No, sorry but leave this question opened for the moment

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Is there still a problem that we can assist you with?  What happened when you followed the advice given by the experts above?
us111Author Commented:
No no I think it's ok. But I need to test...
us111Author Commented:
Please leave it opened.

I know you have to clean but this question has only 3 month. I think it's better to clean questions from 2005!

I'm gonna do my best to close it.  btw i will increase the points
us111Author Commented:
I'm agree with your arguments

Anyway, as I have no time to test I suppose it works......

Points splited
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.