Welcome to WebmasterWorld Guest from 18.210.22.132

Forum Moderators: open

Message Too Old, No Replies

Easiest way to redirect all traffic

What is the Easiest way to redirect traffic?

     
2:25 am on Dec 28, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 9, 2003
posts:60
votes: 0


I have recently completely redone my site and all of the names of the files have been changed to something else. I want to redirect any traffic from these old sites to their new counterparts. What is the easiest way to do this? What is the code for a redirect?
5:20 am on Dec 28, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


How many old pages need to be redirected? And does every old page have a different new page that you want to get the traffic?
8:12 am on Dec 28, 2003 (gmt 0)

New User

10+ Year Member

joined:Oct 15, 2002
posts:30
votes: 0


Depends on what technology you have available to you.

If its ASP, or ASP.NET a simple .asp or .aspx file with the following will suffice.

<% response.redirect("http://www.somewhere.com/") %>

If you only have html a meta refresh can do it.
<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.htmlhelp.com/">

PHP and the rest of the popular technologies can do the redirect VERY easily as well.

If your web host has custom errors, then anytime you got an error you could redirect somewhere else.

Hope this helps.

7:02 pm on Dec 28, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 9, 2003
posts:60
votes: 0


Yes, EVERY page has a corresponding new page which it must redirect to. The reason why is because all my old pages were .php but my new pages dont use php so they are just .html.

So, since they are PHP pages, whats is the best way to redirect visitors to the new html pages.

for example

old page was www.mysite.com/widgetpage.php
new page is www.mysite.com/widgetpage.html

The reason why im not making php pages anymore is cuz I have noticed that some visitors get scared linking to a page with an extension they dont recognize.

Thanks for the help.

7:03 pm on Dec 28, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 9, 2003
posts:60
votes: 0


Oh yeah, its a site of about 100 pages.
3:32 pm on Dec 29, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Nov 15, 2003
posts:329
votes: 0


You can also use a java redirect I guess...something like this will redirect from whatever the page that opened is if it doesnt match what it says in the script.

Example if I paste this into the head tag of widget.php
it will jump right to widget.html cos it doesnt match the address in the script.

<SCRIPT LANGUAGE="JavaScript" type="text/JavaScript">
<!--
if ((self.location!= 'widget.html') && (top.location == location)) {
self.location = 'widget.html';
}
//-->
</SCRIPT>

5:29 pm on Dec 29, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 14, 2003
posts:60
votes: 0


Is this a temporary redirect until links have been updated? I've been reorganizing my site and a lot of filenames have changed so I've utilized redirects also. It can get ugly if there are a lot of them though. I use google to locate links to the pages I'm changing and alert the webmaster of the link change. Most are appreciative and a little shocked I would bother to alert them.

From Google search:
link:www.domain.org/dir/file.php

This might not be do-able with so many pages, but it works in certain situations. AFAIK it is case sensitive and results aren't updated immediately so this can create inaccurate results.

5:44 pm on Dec 29, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 9, 2003
posts:60
votes: 0


I am redirecting the traffic because I have many users who have made my site part of their favorites. I want to make shure that they dont think the site is down.
5:55 pm on Dec 29, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:June 20, 2003
posts:558
votes: 0


I am posting an article to an seo site on this subject very shortly. If you like I could sticky a link to you in advance..perhaps you could even give me some pre-publish feedback..
9:37 pm on Dec 29, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 9, 2003
posts:60
votes: 0


Yeah that sounds good man. Id appreciate that.
4:21 am on Dec 30, 2003 (gmt 0)

New User

10+ Year Member

joined:Dec 29, 2003
posts:16
votes: 0


DJ,

If you're running Apache, you can use the following line in your .htaccess (if you have mod_rewrite loaded):


=== CUT HERE ===
RewriteEngine On
RewriteRule /(.*) http://new.site.com/$1 [RL]
=== CUT HERE ===

This will cause apache to redirect all requests to the new target domain. Of course, redesigns are rarely that simple, so you might want to look at the "mapping" facility of mod_rewrite to do the dirty work.

The details of the RewriteMap command require far too much Black Magic for me to summarize here, but you can read for yourself how you can map lists of URIs to alternates at [httpd.apache.org...]