homepage Welcome to WebmasterWorld Guest from 54.196.69.189
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
Meta Refresh Question
Another way?
madcat




msg:971009
 5:13 am on Feb 21, 2003 (gmt 0)

Hi All-

Many people are coming to my site, leaving off the 'www' part of the URL. To work in appliance with a script that I have, I need them to come through the www.mysite.com domain. So, I need a way for the page to redirect to www.mysite.com when they type in just mysite.com.

Everything I try creates a loop and crashes the browser. That is:

<meta-http-equiv="refresh" content="0; url=http://www.mysite.com/"> or PHP,
header("Location: [mysite.com")......]

Both create loops. Any help is appreciated!

 

jdMorgan




msg:971010
 5:19 am on Feb 21, 2003 (gmt 0)

madcat,

You could use a server-side redirect. Try a WebmasterWorld site search for "301 redirect" and you'll finds tons of info. You'll have to sort the threads out by server type to get the right method for your server.

HTH,
Jim

MWpro




msg:971011
 5:20 am on Feb 21, 2003 (gmt 0)

Technically aren't www.yoursite.com and yoursite.com the same thing?

I found a few neat ones on google, type in "better redirect script" or something along those lines and you should come across some good ones.

madcat




msg:971012
 5:35 am on Feb 21, 2003 (gmt 0)

Excellent, thanks for your help...

Yeah they're the same, but for some reason my scripts become disabled without the full domain. Strange to me.

jdMorgan




msg:971013
 5:41 am on Feb 21, 2003 (gmt 0)

www.example.com is a subdomain of example.com, and is not the same thing - unless your DNS zone file is set up to treat them the same (admittedly, many are).

Check out the server-side redirect threads - more efficient than scripting and it's a "set and forget."

Jim

4serendipity




msg:971014
 4:25 am on Feb 23, 2003 (gmt 0)

If you're running apache and mod_rewrite is installed the following should work:


RewriteEngine On
RewriteCond %{HTTP_HOST}!^www\.example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

jdMorgan




msg:971015
 4:57 am on Feb 23, 2003 (gmt 0)

You'll need a space in front of the "!" for this to work. The WebmasterWorld posting routine deletes these spaces.
Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved