Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do a 303 redirect? 1

Status
Not open for further replies.

DaRNCaT

Technical User
Dec 18, 2002
566
NZ
I've found a few links on the code needed, but I'm not sure how to apply it to a page- I have to go through page by page I think, as I don't have access to the server to put a list of redirects on it.
the code I have is
Code:
HTTP/1.1 301 Moved Permanently
Location: [URL unfurl="true"]http://www.newurlhere.[/URL]

where do I put this on the page, and does it need anything extra? I've been told to wipe the pages, but do I need html head body tags still?

I'm confused :)

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Are you using PHP?

If so, use the header() function. However you cannot output anything to the browser before using it.


Something like this

Code:
<? //301 redirect
header("HTTP/1.1 301 Moved Permanently");
header("Location: [URL unfurl="true"]http://www.foamcow.com");[/URL]
header("Connection: close");
?>


Foamcow Heavy Industries - Web design and ranting
Toccoa Games - Day of Defeat gaming community
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
"I'm making time
 
Nope, not using PHP, these are straight HTML pages I am (I assume) putting the redirects on.
I don't have access to the htaccess files, - I'm making a list and sending it to the IT person, but they only just replied to my re-direct query of 2 weeks ago and said my original redirection was incorrect (I used a meta tag refresh redirection on each page) and I'd need to use a 300 style redirection, but they gave me NO instructions barring I'd have to delete the incorrect pages.
I would imagine it will take them another 2 weeks to add the htaccess adjustments, and I am wondering it the 300 redirect can be put on the html pages themselves until the htaccess has been done.

thanks :)


----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
I fail to see why the said a meta refresh was incorrect, I'll assume the reputation of meta refresh with SEs. However the current state of play appears to be;

Ron Carnell said:
A meta-refresh, coded directly in the page, can now take the place of a server-side redirect. Considering how badly meta-refreshes have been abused by spammer in the past, this is surprising news. But it's also good news, especially for the many webmasters who don't have access to server level redirects. A meta-refresh of 1 second or less will be treated as a 301, while anything longer than 1 second will be considered a 302.
From this article (about 1/2 way down in the "---- You Can't Really Get There From Here? ---- " section)

You won't be able to use a php redirect unless they add .htm to the list of files that are parsed as php into the .htaccess

AddType application/x-httpd-php .php .htm .html

It may be much easier and better for your peace of mind to have this done rather than rely on them to write the htaccess redirect, because if they get it wrong and it then takes another two weeks to sort out, you are going to be in deep [curse].

and to use any on page server side code redirect you should delete all the content first. For a meta refresh just leave the open and close <html> and <head> tags with the meta content-type and meta refresh tags in place.


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
brilliant, thank you!

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top