sleepy_sentry — 2012-03-25T18:47:15-04:00 — #1
So I'm in the process of migrating an old site based on a CGI script based to Wordpress. For right now I want to redirect a few individual pages on octools.com to another domain, octools.net. Here's my .htaccess file:
Redirect 301 /index.cgi?caller=articles/mushkin/pc4400/pc4400.html http://www.octools.net
This is to move http://www.octools.com/index.cgi?caller=articles/mushkin/hp3200/hp3200.html to http://www.octools.net.
Oddly, I'm getting a 404 Not Found error.
Not Found The requested URL /index.cgi was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
When I changed the redirect to include the entire root domain (Redirect 301 / http://www.octools.net), it works. So there is something about /index.cgi? that my .htaccess doesn't like.
Any idea on how to get this working? It's worth noting that I don't have the script on my server-- I recently acquired this site and didn't receive the CGI script due to licensing reasons.
dklynn — 2012-03-25T23:30:47-04:00 — #2
You want to change a .com linked script and query string to a domain? That's undoubtedly how Apache interprets it. If this is all of your .htaccess (i.e., not using a DirectoryIndex with index.cgi before anything else in the DocumentRoot), then Apache is doing exactly what you specified.
What are you really trying to do? Use WP? Then address the WP handler script (index.php) in your Redirect statement.
If .com and .net are superimposted, share the DocumentRoot, then merely use a redirect from index.cgi to index.php. If you need to retain the query string, use mod_rewrite to redirect (the query string will go along without you doing anything special. You're making it harder than it really is.