Forum Moderators: phranque
I recently used mod_rewrite to change my dynamic URI's to static ones, such that
[mysite.com...]
becomes the 'real' page at
[mysite.com...]
Google picks up the nice new short format, but it had already indexed the dynamic URIs and now lists two sets of identical pages bar the URI. The .php?get=XXX versions are never going to 'fade out', because they're obviously always going to be valid, but I'd really rather hide their existence completely in favour of the .html version.
Is it possible to do some whacky mod_rewrite voodoo to rewrite the incoming URI from the dynamic form with a redirect 301 to the static form, which would hopefully flag Google to drop the page, and then rewrite the URI as above 'silently', so that the nice static URI remains in the address bar?
I'd imagined doing something like:
RewriteEngine on
RewriteRule ^displaywidget\.php\?get=(.*) /widget$1.html [NC,R=301]
RewriteRule ^widget(.*)\.html /displaywidget.php?get=$1 [NC,L]
but to no avail.
I'm sorry if this has been answered already, but I can't find the proper techie terms to describe the problem so I'm having no luck searching.
P.S. I know it sounds like a solution in search of a problem, but I took a significant rankings hit after the change so I'm trying to get everything back as close to the previous state of affairs as possible.
You'd still have to make sure that all the links to the .php?get=XXX pages are replaced with links to the new pages. Otherwise, you'll still get duplicate listings and the PR would be divided between the two.
Using mod_rewrite would have been easier if there was a way to stop the infinite loop. I know a way to do it, but since most of the links to your .php pages were on your site anyway, I recommended the easy way out. :)
You're welcome, Tippy.
It also has no effect on any other HTTP request. Since these are 301 redirects, the server will send the 301 response back to the client browser, giving it the new address of the requested resource. The client browser will then issue a new HTTP request for the resource at the new address.
So that's why [L] won't "stop the loop."
Jim