Question: Firstly I'm still beginner in mod\_rewrite.  

Everybody if I have this .htaccess code

```
RewriteEngine On
RewriteRule ^index/(.*)/$ index.php?usr=$1 [L]

```

Is must change the form of the link(href) to 

**Example** 

```
<a href="index/image/">Click Here</a>

```

Or leaving it as is 

**Example** 

```
<a href="index.php?usr=5">Click Here</a>

```

If leave it as is `<a href="index.php?usr=5">Click Here</a>` Will show the link this way `http://domain.com/index/image/`.

**EDIT #1**

Here's a sample of the html code.

```
<div id="main_menu"> 
  <ul> 
    <li><a href="index.php">{$lang.Nav_Home}</a></li> 
    <li><a href="sections.php?cid={$value.cat_id}">{$value.cat_name}</a></li> {else} 
    <li id="moreSection_{$secNum}" style="display: none;"><a href="sections.php?cid={$value.cat_id}">{$value.cat_name}</a></li> 
    <li><a href="javascript:;" onclick="showHideMoreSec('moreSection',this)"> <img src="images/arrow_down.png" alt="{$lang.MainMenu_MoreSection}" title="{$lang.MainMenu_MoreSection}" /> </a></li> 
  </ul> 
</div>

```

Answer: 
I think your issue is that you have to deal with the `PATH` and `QUERY_STRING` as 2 separate elements.

```
http://some.server/sections.php?cid=5
                   ^^^^^^^^^^^^ ^^^^^
                   ||||         ||||
                   path         query string

```

Try a set of rules like so:

```
RewriteEngine on
RewriteCond %{QUERY_STRING}     ^$            [OR]
RewriteCond %{QUERY_STRING}     ^cid=(.*)$    [NC]
RewriteRule ^/sections.php$     /sections/%1? [NC,L,R=301]

```

These rules are doing the following. 1st `RewriteCond` is skipping if there isn't a `QUERY_STRING`. The 2nd `RewriteCond` saves the bit after the equal sign in a variable, `%1`. The last line, `RewriteRule`, builds up our new `PATH`, */sections/%1*, any time a */sections.php* line is encountered, and had a `QUERY_STRING`, *cid=...*.

A sample html file:

```
<html>
  <body>
  <a href="/sections.php?cid=5">Click Here</a>
  </body>
</html>

```

Hovering on the Click Here link on the above page shows this:

```
http://localhost/sections.php?cid=5

```

Clicking this link takes me to this URL:

```
http://localhost/sections/5

```

my /var/www/html has the following:

```
% tree /var/www/html
/var/www/html
|-- test.html
`-- sections
    `-- 5

1 directory, 2 files

```

**Resources**

* [Apache wiki - Manipulating the Query String](http://wiki.apache.org/httpd/RewriteQueryString)
* [statichtml blog - mod\_rewrite based on query string parameters](http://statichtml.com/2010/mod-rewrite-baseon-on-query-string.html)
No. The `RewriteRule` only matters when the user makes a request to the server. It does not affect what they will see when they hover over the link, and it won't change the address that they see *from* what you change it to *to* what you change it from (meaning: you're rewriting `index/image/` to `index.php?usr=image`; it won't change it the other way, from `index.php` to `index/image/`).