Forum Moderators: phranque
Iīm very new to rewrites and have one problem I canīt figure out.
We had a mayor change with my website and lost a lot of serps doing it. I believe that part reason for it is a problem with the rewrite.
I wonder if a rewrite actually acts as a 301 redirect (permanent) or as a 302 (temp).
we are using this rewrite:
RewriteRule ^cat\.htm$ /catredirect.jsp?%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.htm$ /catredirect.jsp?catid=$1&%{QUERY_STRING}
and the file "catredirect.jsp" does a redirect using a database with the url names.
We not sure if this way we redirect a 301 or 302.
To go around the catredirect.jsp I want to put a strait 301 redirect into our htaccess using:
redirect 301 /categories.php?cat_id=65 http://www.example.com/nature-pictures-cat.htm
redirect 301 /categories.php?cat_id=30 http://www.example.com/alaska-pictures-cat.htm
as well as:
redirect 301 /cat65.htm http://www.example.com/nature-pictures-cat.htm
redirect 301 /cat30.htm http://www.example.com/alaska-pictures-cat.htm
Now here are our problems:
1. I think Iīm not supposed to use the "http://www.example...., but when I donīt use it I get a server error
2. the redirects categories.php?cat_id=65 etc, donīt work and I end up in my error page (no server error as long as I use the http:www.hic...)
what can I do to make sure that the old categories get a 301 (I believe after loosing lots of rankings that our redirect right now is not a 301).
I do have a dedicated server but donīt know enough to do a apache rewrite for this!
I appreciate your input.
thanks
[edited by: jdMorgan at 5:38 pm (utc) on Aug. 1, 2005]
[edit reason] No personal URLs, please. See TOS. [/edit]
Having done that, you can modify your scripts to output the desired URLs on your pages, redirect the alternate URLs to the desired URLs, and then rewrite the desired URLs to the actual server paths needed to run your script. It's not complicated, once the problem is clearly defined.
Note the use of the terms, "redirect" and "rewrite." These are not equivalent, and the distinction is important:
A redirect issues a response to a client (e.g. a browser) that says, "The resource you requested has moved, ask for it again here [webmasterworld.com]." This ends the current HTTP transaction. The client must then re-request the resource from the URL provided by the redirect response. In doing so, it will change the address in the browser address bar.
A rewrite is completely internal to the server, and takes place entirely within the context of the current HTTP request. It simply instructs the server to get the resource from a different filepath than that implicitly given in the HTTP request.
Use the Server headers checker [webmasterworld.com] to determine what kind of redirects your server is issuing for your current page requests.
Jim