[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 12-13-2005, 11:39 AM   #1 (permalink)
tgo
NamePros Regular
 
Join Date: Aug 2005
Posts: 317
103.75 NP$ (Donate)

tgo is on a distinguished road


ASP 301 redirect from www to non

I am looking to create a 301 redirect from my www(dot)name.com to just name.com

I run a dedicated windows server so I cant use htaccess, I also dont pay for mod rewrite. So how can I redirect the www to non www.

I can write asp that does the 301, but how do I detect that there is a www in the url? Do I just read the current page name and do a instring function to check? Then redirect to itself without the www if needed....

Any easier way to do this? This way I would have to have this code on all my pages to jump out of www when needed.

Last edited by tgo; 12-13-2005 at 11:59 AM.
tgo is offline  
Old 12-13-2005, 04:36 PM   #2 (permalink)
Senior Member
 
def1's Avatar
 
Join Date: May 2005
Posts: 1,537
293.00 NP$ (Donate)

def1 has a spectacular aura aboutdef1 has a spectacular aura about


i would think redirecting to a link without the www will work
__________________
Did you try my toolbar? Works in Firefox and IE!
http://www.bumrecords.net - Fun Games, Music, Discussion, And Much More!
upload˛
•Pick the Web Hosting Company most NamePros Members Use Pick Chronichosting!•
def1 is offline  
Old 12-14-2005, 03:21 PM   #3 (permalink)
mch
NamePros Regular
 
Join Date: Nov 2005
Location: EU
Posts: 248
99.25 NP$ (Donate)

mch is on a distinguished road


Sorry I don't know ASP, but here's the code in PHP, I hope it helps!

PHP Code:
if ($_SERVER['HTTP_HOST'] == "http://www.mysite.com")
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://mysite.com");
}
mch is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
asp 301 redirect tgo Search Engines 0 10-06-2005 03:15 AM
redirect url .htaccess code dotcommakers The Break Room 1 08-09-2005 01:18 PM
enom question - does the redirect use 301 redirects? rb Domain Name Discussion 11 06-04-2005 06:42 PM
Advertise on Redirect Plus - Starting at $2.95/mo! LeKiz Advertising & SEO Services 0 04-27-2005 09:25 AM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 11:32 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85