Redirect question

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Redirect question
Browser
CZ Super Newbie
 Codezwiz Site Donator
Browser has been a member for over 19 year's 19 Year Member
Status: Offline
Joined: Nov 14, 2004
0.01 posts per day
Posts: 48
Points: 5,631
   
I have seen some sites such as Google redirect from google.com to [ Register or login to view links on this board. ] google.com (adding the www).

Is there a way I can remove the www so users are redirected to the non www url. Some browsers are having trouble with the www and phpnuke but all works fine without the www being used.

I tried the .htaccess redirect script in the knowledgebase but could not get it to work on my server which is running Ensim.



Back to top Reply with quote
#2   re: Redirect question
crazzy_cue_kill
CZ Newbie
crazzy_cue_kill has been a member for over 20 year's 20 Year Member
usa.gif washington.gif
Age: 36
Gender: Male
Fav. Sports Team: 49ers
Website:
Status: Offline
Joined: Aug 27, 2004
0.00 posts per day
Posts: 28
Points: 3,561
AIM Address Yahoo Messenger MSN Messenger 
Try this man its a redirect code from admins101.com

<BODY onLoad=window.setTimeout("location.href='http://your-page-to-redirect-to.html'",10000)>


this redirect is on a timer, 10000 being 10 seconds after the page loads, just change it to what ever you want. hope this helps icon_wink.gif


Back to top Reply with quote
#3   re: Redirect question
Browser
CZ Super Newbie
 Codezwiz Site Donator
Browser has been a member for over 19 year's 19 Year Member
Status: Offline
Joined: Nov 14, 2004
0.01 posts per day
Posts: 48
Points: 5,631
   
I will give it a try but I only want to redirect the www to the non www same page so if someone types the url [ Register or login to view links on this board. ] they get [ Register or login to view links on this board. ]

I am not sure how the redirect above will work in the template and pointing to the same page with the non www URL. (ie will it just refresh the page and will the other pages be redirected since it is a template system and not seperate pages).

I was wondering if there is something that .htaccess can do to remove the www or how I would use the redirect script in the knowledgebase for my situation if the above script does not work.

Thanks for the suggestion, I will give it a try...



Back to top Reply with quote
#4   re: Redirect question
GoddsEgo
PayPal Donation
CZ Moderator
Status: Offline
Joined: Jun 26, 2003
0.16 posts per day
Posts: 1211
Points: 69,166
 Yahoo Messenger  
Hi Browser


Assuming your root index file name to your site is index.php and the .htaccess is in same folder and that you are uploading the .htaccess file as a ASCII text file, then try the following...


Create a blank html document and name it
index.htm

Upload it into your sites root directory

In your .htaccess insert the following 2 lines, edit line 2 by placing your domain name in where specified...

DirectoryIndex index.htm
Redirect /index.htm http://YOUR_DOMAIN_NAME_HERE.com/index.php



Here's a working example copy n paste this address into your browser and you will see that I have it redirecting to a sum folder and the www is stripped from address

http://www.blackballtimes.com/

How it works

Using the DirectoryIndex cmd you are able to specify the default index file name for the directory. So we make the default index any file name but our actual index.php name. We chose index.htm

(the index.htm file you created and uploaded isn't really needed, the .htaccess will process the 2 lines before any action is taken, I just have a personal problem with referring to a page that is not valid lol)

Anywho the second line is our redirect code. The 3rd elements to this line is make this whole technique possible,

1. The cmd (redirect) ,

2. Followed by the pages address to be redirected from relative to our root directory,

3. And finally the ENTIRE address to the page that we are redirecting to.

The www in an internet address is not required. This it why we can not simply redirect from our root index page address to the root index page address without the www in it. Trying to do so will just cause a loop of endless redirecting or the browser to time out page. This is also why alls we have to do to remove the www is leave it out of the address that we are redirecting to.


So first we set a default index file name then redirect to the address we really want to be the default index


lmao make sense?

Gl
Rob


Back to top Reply with quote
#5   re: Redirect question
Browser
CZ Super Newbie
 Codezwiz Site Donator
Browser has been a member for over 19 year's 19 Year Member
Status: Offline
Joined: Nov 14, 2004
0.01 posts per day
Posts: 48
Points: 5,631
   
Very cool. Now I know why I could not get the redirect example in the knowledgebase to work, it was creating a loop and giving me an internal server error.

Thank you!



Back to top Reply with quote
#6   
GoddsEgo
PayPal Donation
CZ Moderator
Status: Offline
Joined: Jun 26, 2003
0.16 posts per day
Posts: 1211
Points: 69,166
 Yahoo Messenger  
Yw

Was an interesting puzzle to work thru ty



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum