SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry 301 Redirect Returns 404 Not Found Error

    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:
    Code:
    Redirect 301 /index.cgi?caller=articles/mushkin/pc4400/pc4400.html http://www.octools.net
    This is to move http://www.octools.com/index.cgi?cal...00/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.

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    SS,

    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.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •