Forum Moderators: phranque
http://example.com?fid=nnn
In that file, I have a re-direct that sends the user to:
http:/example.com/show/nnn
And this works. But Google still tells me that I have over 4000 invalid URLS because apparently their spider doesn't pick up the redirect. (I'm doing php headers command, not meta redirect).
I'd like a 301 command in my htaccess that would work for any value of nnn something like this:
redirect 301 http://example.com?fid=%1 [mysite.com...]
but I am unsure of all that is required to parse off the nnn value and assign it to %1. Can anyone help?
[edited by: jdMorgan at 1:34 am (utc) on Aug. 4, 2008]
[edit reason] example.com [/edit]
[added] You may want to review this previous thread: Changing Dynamic URLs to Static URLs [webmasterworld.com], if that is what your overall goal is here. [/added]
Jim
[edited by: jdMorgan at 1:40 am (utc) on Aug. 4, 2008]
But I'm having a difficult time with my specific example. I have many places where the string ?fid=nnn exists. Any time that string exists in the URL, I want the entire new url to be:
http://example.com/show/nnn
This is to take care of may old links in Google where no matter what page I was one before you could pass an fid. BTW, nnn is always numeric.
I am having difficulty with the specific regex chars and syntax for my example. All of the examples I find are for turning a single dynamic page into a static one.
Due to the number of requests and the limited number of contributors here, we are set up to answer specific questions and focus on helping members learn, rather than just dashing off code. The concepts you need are:
The linked citations above plus the documents cited in our Forum Charter will get you well on your way to solving this problem. And more to the point, reading those documents will give you the background to understand any solution we might help you develop here, so that you can maintain and modify it as needed -- and perhaps use it as a basis to understand further applications of the compact and powerful mod_rewrite tool.
Jim