User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Quick PHP question (change location to not www) Page [1]  
GiZZ
All American
6982 Posts
user info
edit post

There should be a quick one or 2 line solution. All I want is if someone ever comes to the page via http://www.domain.com that it automatically changes the location header to be domain.com (takes out the www)

1/5/2006 3:02:27 PM

OmarBadu
zidik
25071 Posts
user info
edit post

this is a google question - not tww

1/5/2006 3:06:13 PM

GiZZ
All American
6982 Posts
user info
edit post

Fuck you. I asked google already.

1/5/2006 3:22:37 PM

kinetix
All American
3122 Posts
user info
edit post

oops

[Edited on January 5, 2006 at 4:51 PM. Reason : ]

1/5/2006 4:49:47 PM

qntmfred
retired
40726 Posts
user info
edit post

header("Location: " . preg_replace("/^w ww./", "", "http://www.google.com"));


[Edited on January 5, 2006 at 5:18 PM. Reason : www]

1/5/2006 5:16:39 PM

GiZZ
All American
6982 Posts
user info
edit post

hah. thx.

1/5/2006 5:17:53 PM

Stein
All American
19842 Posts
user info
edit post

^^

That won't work. The w isn't at the beginning of the string.

If you want something quick and dirty:

header("Location: " . preg_replace("/\/[w]{3}\./", "", "http://www.domain.com");


should work.

Though the proper answer is mod_rewrite

[Edited on January 5, 2006 at 5:49 PM. Reason : .]

1/5/2006 5:48:25 PM

qntmfred
retired
40726 Posts
user info
edit post

oops, i had the search string as ^http://www but tww inserted the link tags and i must have removed the http part while trying to fix it.

mod_rewrite is an apache solution, not a php solution (not all web servers use apache)

but yeah, there are lots of ways to do this

[Edited on January 5, 2006 at 6:25 PM. Reason : tww sucks]

[Edited on January 5, 2006 at 6:38 PM. Reason : though i prolly could have escaped the period]

1/5/2006 6:24:51 PM

 Message Boards » Tech Talk » Quick PHP question (change location to not www) Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.