g1smd - 7:25 pm on Jul 26, 2013 (gmt 0)
when I hover over link at testing page,the link doesn't change
My goal is to rewrite some link to another one
Mod_rewrite cannot make or change a URL. Mod_rewrite cannot alter the links on your pages.
You need to physically alter the href value of the links on your page to use the new URL format that you want users to see and use.
Once that new format link is clicked, the browser will make a request for that new format URL.
Once the URL request reaches the server, the URL path will (hopefully) match the RegEx pattern in the rewriting Rule. The internal file pointer in the server will be amended such that Apache will attempt to fetch /index.php?page=about from the hard drive instead of trying to fetch /testing/about-us (which doesn't physically exist as a file of that name) from the hard drive.
The action of altering the internal file pointer so that Apache fetches content from a different internal location to the one specified in the requested URL is called a "rewrite".
This comes as a surprise to many. It's the exact opposite of what many people think a rewrite is, or does.
The links on the site are in the new format and the site works fine with those new URLs, so where's the redirect figure in all this?
Simples! Requesting a URL in the old format will still return content, content identical to that returned when the new format URL is requested. You've run into the classic Duplicate Content problem.
You may think that because the site now links to the new format URLs, Duplicate Content isn't a problem, but it is. Visitors will still be asking for old format URLs after clicking links from other sites and found in stale search engine listings. More importantly, because the old URLs still work and still return "200 OK" status, Google will continue to request those old URLs forever.
This is why you install the redirect. Once that is in place, anyone or anything asking for the old URL is told in no uncertain terms, via the 301 redirect, that the content is at a new URL.
The browser or bot requests that new URL. The new request matches the RegEx pattern in the Rule that rewrites, and Apache proceeds to fetch content from /index.php?page=about as expected.
It is really important that the differences between redirects and rewrites are fully understood. It's massively important to note that a RewriteRule can be configured as a redirect or as a rewrite and you need one of each here.
One final thing to note is that the redirecting Rule must be paired with a RewriteCond testing THE_REQUEST looking for an old format request with parameters. The RewriteCond is VITAL in preventing an infinite redirect-rewrite-redirect-rewrite... loop.
Please also read my step 1, step 2, step 3, post again. It's message #4596309 further up the page.