Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/82265-i-have-an-idea/#findComment-418149
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/82265-i-have-an-idea/#findComment-418153
Share on other sites

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']}");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/82265-i-have-an-idea/#findComment-418158
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/82265-i-have-an-idea/#findComment-418163
Share on other sites

# 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/

Link to comment
https://forums.phpfreaks.com/topic/82265-i-have-an-idea/#findComment-418254
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.