Closed Thread Icon

Preserved Topic: Redirecting w/Status Code 301 Returned Pages that link to <a href="https://ozoneasylum.com/backlink?for=12244" title="Pages that link to Preserved Topic: Redirecting w/Status Code 301 Returned" rel="nofollow" >Preserved Topic: Redirecting w/Status Code 301 Returned\

 
Author Thread
brucew
Paranoid (IV) Inmate

From: North Coast of America
Insane since: Dec 2001

posted posted 05-31-2002 19:52

I'm moving some stuff around my site and changing some filenames. I know how to redirect using http-equiv but I'd like something more elegant (so that I don't have to clutter the site with all the "old" filenames just to redirect) that will also inform robots/spiders that the redirection is permanent in the hope that they'll remove the old files from their indexes.

I found a reference in the Apache documents, but too abstract to penetrate my skull too deeply. Additionally, because I'm on shared hosting, I don't have access to the modules and stuff that may affect other domains on the server.

I DO have access to .htaccess and have modified it before, so if this can be done there I know I can do it. I need a "type this here you daft boy" approach though, rather than something like what's in the Apache docs.

Any help?

"the most incredible feats are often accomplished by
those who have had the most incredible challenges"

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 06-01-2002 04:38

brucew: If I understand correctly you may be looking for something like PHP's header function:
http://www.php.net/header/

specifically things like:

header("HTTP/1.0 404 Not found");

___________________
Emps

FAQs: Emperor

brucew
Paranoid (IV) Inmate

From: North Coast of America
Insane since: Dec 2001

posted posted 06-01-2002 22:54

Sorry Emps. Not using PHP. (I wanted to complete this project before I begin trying to learn it.) I understand where it would be confusing as this is the server-side scripting forum, but I didn't know where else to put the question. Let me rephrase it to make it clearer.

Every time a file is accessed a result code is sent to the user-agent. The code most people are familiar with is the dreaded 404 for "resource not found", although generally it's code 200 for "everything's cool".

Code 301 is intended to tell the user-agent (my intention is to tell Googlebot, Slurp, Scooter, et.al.) that the URL has changed permanently.

Can I put some lines in .htaccess to perform the redirection and send Googlebot a code 301?

If so, exactly how do I craft the lines?

"the most incredible feats are often accomplished by
those who have had the most incredible challenges"

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 06-02-2002 08:07

type this here you daft boy

RedirectPermanent /path/to/oldfile.htm http://www.domain-name.com/url/to/new/file.htm


Use that in your .htaccess file. We used that when we went from a static site with ~100 pages to a PHP/MySQL site with 500+ pages all using one of three templates. Works great. You MUST use the path name in the first part, and the URL in the second. So, we ended up with something like:

RedirectPermanent /divisions/swat http://www.macombsheriff.com/article.php?aid=37

Which you can test by going to http://www.macombsheriff.com/divisions/swat which will redirect you to http://www.macombsheriff.com/article.php?aid=37

Hope this helps....



[This message has been edited by Pugzly (edited 06-02-2002).]

brucew
Paranoid (IV) Inmate

From: North Coast of America
Insane since: Dec 2001

posted posted 06-02-2002 16:19

Thanks Pugzly!

I'll give it a whirl as soon as the coffee kicks in.

"the most incredible feats are often accomplished by
those who have had the most incredible challenges"

brucew
Paranoid (IV) Inmate

From: North Coast of America
Insane since: Dec 2001

posted posted 06-02-2002 17:36

Ah ha! Works like a charm. Thanks!

"the most incredible feats are often accomplished by
those who have had the most incredible challenges"

« BackwardsOnwards »

Show Forum Drop Down Menu