View previous topic :: View next topic |
Author |
Message |
Vahn -
Joined: 10 Aug 2005 Posts: 51 Location: At my computer
|
Posted: Sat Nov 11, 2006 6:06 am Post subject: Php Redirect |
|
|
Okey Guys, its been a while but Problem Vahn has Returned!
alright alright, simmer down.. applause at the end of the Post..
anyways..
I have my self a Fancy little Domain (nod) and i'm trying to make a PHP url redirect that will HOLD the url heading, no i don't have access to DNS and all that good stuff, i have either the option to Tell the Server, -redirect www.whatever.com to http://serverIP:port/ or to Direct it to (MyRoot) ( its not my server and i don't want to move my Site to the server there soo.. i came to the Conclusion that i need a URL redirect
i figured I'd have the server redirect all 404's to /index.php and then go form there using $_Server['REQUEST_URI'] and on and on...
Anyone actually done this or knows how to do this before i spend a week picking at it?
thx allot in advance
-Vahn _________________ A ship in the harbor is safe, But thats not what Ships were Built for. ~ John Shedd
Success Comes before Work only in the Dictionary ~ Harvey Mackay
 |
|
Back to top |
 |
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Nov 11, 2006 6:38 am Post subject: |
|
|
I could try and help you do this. Can you give me more information why you
need to use the 404 errors? I don't understand. |
|
Back to top |
|
 |
Vahn -
Joined: 10 Aug 2005 Posts: 51 Location: At my computer
|
Posted: Sun Nov 12, 2006 11:25 pm Post subject: |
|
|
Well Say some one Goes to my Site they type in the Url box in firefox ( or what ever ) "Http://www.citadelindustries.com/Foo/Bar/" it goes to my Host and since '/foo/bar/' does not exist on the host server ( all there is on that server will be the redirect page and a favicon image ) it'll 404, then have404 Redirect to the redirect page, thats where this comes in, it'll get info and then Re-direct you to http://74.37.231.39/foo/bar/ possibbabally useing Header()? who knows i'm not exactly sure how to do this so... thats why i came here =D annnd if at all possible to Keep the www.citadelindustry.com/foo/bar/ up there in the url box that'd be very sweet too But if not that is Fine..
-Vahn _________________ A ship in the harbor is safe, But thats not what Ships were Built for. ~ John Shedd
Success Comes before Work only in the Dictionary ~ Harvey Mackay
 |
|
Back to top |
 |
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
|
Back to top |
|
 |
Vahn -
Joined: 10 Aug 2005 Posts: 51 Location: At my computer
|
Posted: Mon Nov 13, 2006 1:58 pm Post subject: |
|
|
Well i've been doing a little Screwing around didn't get very far.. this is what i got ( and Get)
Code: | <?php
$URI = $_SERVER["REQUEST_URI"];
if ($URI = "/test.php"){
$URI = "/index.php";
}
$URL = "http://74.37.231.39$URI";
include "$URL";
/*
$instr = strrpos($handle,"<Title>") + 7;
$instr2 = strrpos($handle,"</Title>");
$Title = substr($handle, $instr, $instr2);
*/
?>
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<Html lang="en">
<Head>
<META NAME="description" content="">
<META NAME="keywords" content="">
<TITLE><? echo $title; ?></TITLE>
</HEAD>
<!-- <? echo $URL; ?> -->
<!-- <? echo $URI; ?> --><!--
<FRAMESET ROWS="100%,*">
<FRAME SRC="http://74.37.231.39/" SCROLLING="AUTO" NAME="bannerframe" NORESIZE>
</FRAMESET>
<NOFRAMES>
<P>Citadel Industries
<DIV ALIGN="CENTER"><A HREF="http://74.37.231.39/">http://citadelindustry.com/</A></DIV>
</NOFRAMES>
</HTML>--> |
and i get this error:
Code: | Warning: include(http://74.37.231.39/index.php) [function.include]: failed to open stream: Connection timed out in /homepages/1/d115845883/htdocs/citadel/test.php on line 10
Warning: include() [function.include]: Failed opening 'http://74.37.231.39/index.php' for inclusion (include_path='.:/usr/local/lib/php5') in /homepages/1/d115845883/htdocs/citadel/test.php on line 10 |
same thing when i try fopen
-picks at brain and grumbles to self-
-Vahn _________________ A ship in the harbor is safe, But thats not what Ships were Built for. ~ John Shedd
Success Comes before Work only in the Dictionary ~ Harvey Mackay
 |
|
Back to top |
 |
 |
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Mon Nov 13, 2006 3:16 pm Post subject: |
|
|
try header() instead
Code: | header("Location: $URL"); |
_________________ Anthony R
Roganty | Links-Links.co.uk |
|
Back to top |
|
 |
Vahn -
Joined: 10 Aug 2005 Posts: 51 Location: At my computer
|
Posted: Mon Nov 13, 2006 7:03 pm Post subject: |
|
|
doen't that just send you to $URL? i want to open the file remotely and gtet some elements from it _________________ A ship in the harbor is safe, But thats not what Ships were Built for. ~ John Shedd
Success Comes before Work only in the Dictionary ~ Harvey Mackay
 |
|
Back to top |
 |
 |
Marty -
Joined: 10 Sep 2006 Posts: 83
|
Posted: Mon Nov 13, 2006 8:23 pm Post subject: |
|
|
Create an index. file and place this simple code as it is into it or add foo/bar/ to the url.
Code: | <frameset rows="*">
<frame src="http://74.37.231.39/">
</frameset> |
Now anyone going to http://www.citadelindustry.com/ or this www.citadelindustry.com/foo/bar/ pending on which directory you place the index file into, will end up at http://74.37.231.39 with http://www.citadelindustry.com in the address bar. Is that what you wanted ?
EDIT: works fine on IE & Firefox
Last edited by Marty on Tue Nov 14, 2006 12:16 am; edited 1 time in total |
|
Back to top |
|
 |
Vahn -
Joined: 10 Aug 2005 Posts: 51 Location: At my computer
|
Posted: Mon Nov 13, 2006 11:58 pm Post subject: |
|
|
Well yeah
on the URL Server ( the citadelindustry.com one ) if the user goes www.citadelindustry.com/whatever.html they get 404'ed because it doesn't exist Right
so i have my htaccess redirect any 404 errors to index.php
and index php gets the uri ( what they were after ) and re-pastes it to the Frameset... thats where i'm at right now.. Except it only works on some files/folders because i geuss apache hates me..
EDIT: Intrestingly enough, after posting this, I go to the citadel server and try a few links and it does pretty muchw hat i want @.@ i'll play aaround with the Script and What not and post it For anyone else who wants to do the same -shrug-
-Vahn _________________ A ship in the harbor is safe, But thats not what Ships were Built for. ~ John Shedd
Success Comes before Work only in the Dictionary ~ Harvey Mackay
 |
|
Back to top |
 |
 |
|