quickstopman Posted December 19, 2007 Share Posted December 19, 2007 i wanna make a script that when a person goes to my site if the server doesn't equal "http://www.example.com" it redirects the user to the same page just a diffent server any ideas? Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 19, 2007 Share Posted December 19, 2007 good idea ! can you explain your idea better? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 19, 2007 Share Posted December 19, 2007 haha, this makes no sense if the url doesnt equal to your site, then they arent on your server. If this was possible, we would hack the internet by now, so everyone is redirected to gay porn or something. You want to say, if the "example.com/isndksndkasd.php" is not a folder/file, you want to redirect the user. Quote Link to comment Share on other sites More sharing options...
quickstopman Posted December 19, 2007 Author Share Posted December 19, 2007 basically what im trying to do its the problem with my server is that to make a new domain it has to be a subfolder in the main site so for example "http://www.example.com/example1" is the directory for my site on the other server and "http://www.example1.com" is the main domain i wanna make it so it redirects the vistor to the same page for example say the URL of the page is "http://www.example.com/example1/index.php" i want it to redirect the visitor to the page "http://www.example1.com/index.php" and all my attemps have caused endless loops Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 19, 2007 Share Posted December 19, 2007 just add a header file on that other page to redirect on the second page is that a problem? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 19, 2007 Share Posted December 19, 2007 Create a index.php in "example.com/index.php" Then do <?php header("LOCATION: example1/"); // change example1 to the folder you want ?> Quote Link to comment Share on other sites More sharing options...
quickstopman Posted December 19, 2007 Author Share Posted December 19, 2007 the thing is i need it to be an if statement because other wise it will cause a loop and i'll get a 500 server hiccup here is the code i made to try to get it to work <?php if(!eregi("http://www.", $_SERVER['SERVER_NAME'])) { header("Location:http://www.socialgrabbr.com/{$_SERVER['REQUEST_URL']}"); } ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 19, 2007 Share Posted December 19, 2007 i wanna make a script that when a person goes to my site if the server doesn't equal "http://www.example.com" it redirects the user to the same page just a diffent server any ideas? Martin Luther King had an Idea Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 19, 2007 Share Posted December 19, 2007 i wanna make a script that when a person goes to my site if the server doesn't equal "http://www.example.com" it redirects the user to the same page just a diffent server any ideas? Martin Luther King had an Idea He also had a dream, a wet one. Listen, if the user is on the correct page, then it will show the correct page. But if the file/dir doesnt exists, then it will show an error page. You can't redirect, unless you edit .htaccess is. I think. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 19, 2007 Share Posted December 19, 2007 Make custom error pages if that's what you want. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 19, 2007 Share Posted December 19, 2007 http://www.htmlbasix.com/customerrorpages.shtml Topic Solved. Quote Link to comment Share on other sites More sharing options...
quickstopman Posted December 19, 2007 Author Share Posted December 19, 2007 topic not solved thats not even remotely close dude Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 19, 2007 Share Posted December 19, 2007 topic not solved thats not even remotely close dude Actually, you don't know what the hell you talking about. Quote Link to comment Share on other sites More sharing options...
mr_mind Posted December 19, 2007 Share Posted December 19, 2007 # If put in a file called .htaccess this little piece of code will redirect # all http requests (all connection requests to port 80) for the /example1/ # directory to the new site. I believe this is exactly what you are asking # for and a plus about this is that it is processed before any scripts take # place. Redirect /example1/ http://www.example1.com/ Quote Link to comment Share on other sites More sharing options...
Zane Posted December 19, 2007 Share Posted December 19, 2007 Actually, you don't know what the hell you talking about. > Lighten up phpSensei. Go count ten. :^) It'll be OK Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 19, 2007 Share Posted December 19, 2007 Actually, you don't know what the hell you talking about. Lighten up phpSensei. Go count ten. :^) It'll be OK Alright, <(#_#)> Quote Link to comment Share on other sites More sharing options...
Goose87 Posted December 19, 2007 Share Posted December 19, 2007 I had the same problem. I wanted to do this exact same thing, and my hosting company told me to use the "add-on" feature, and now when people go to the URL www.example.com it loads all the data from my other www.example.com/example Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.