View previous topic :: View next topic |
Author |
Message |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 5:09 pm Post subject: redirect based on url? |
|
|
Ok, here's the scenario.. I signed up for a .tk domain name and it works great... www.node1.tk or [url]node1.tk[/url]
The problem is, say I want to post a link to a message on my forum somewhere. for example... here's a link to my forum
http://66.46.116.230/phpbb2/
when I try and use my short url, like this...
http://node1.tk/phpbb2/ it takes you to my homepage and not my forums... the .tk totally ignores anything extra.. but it shows up in the address bar as http://node1.tk/phpbb2 but you at my homepage...
so is there a script or something that can be setup so when you get an url like say...
forums.node1.tk
and actually goto the forums instead? follow me?? _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sat May 15, 2004 5:13 pm Post subject: |
|
|
your .tk name is a frameset. You must purchase the domain in order to use url's such as http://node1.tk/phpbb2/ |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 5:19 pm Post subject: |
|
|
eznetlinks wrote: | your .tk name is a frameset. You must purchase the domain in order to use url's such as http://node1.tk/phpbb2/ |
yeah I know that.. but when i use for example 'forums.node1.tk' it takes me to my main page regardless of what I type in front and it shows up in the address bar as forums.node1.tk so I was wondering if there was a way to intercept that 'forums.node1.tk' url before showing the main page and redirect it at my end in the same frameset to the forums..
I'm thinking of just buying the name, hell.. $10 a year... cant go wrong...
Thanks _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sat May 15, 2004 5:31 pm Post subject: |
|
|
Use this as index.php and rename your current index.php to main.php. This is assuming your cuurent index file is index.php. This will makehttp//forums.node1.tk show the forum and all others show your mainpage.
index.php
<?
$ref = $_SERVER["HTTP_REFERER"];
if ($ref == "http//forums.node1.tk")
{
include "/phpbb2/index.php";
}
else
{
include "main.php";
}
?>
However this probably will not show images in phpbb so try this alternate
<?
$ref = $_SERVER["HTTP_REFERER"];
if ($ref == "http//forums.node1.tk")
{
header("location: /phpbb2/index.php");
}
else
{
include "main.php";
}
?> |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 5:42 pm Post subject: |
|
|
Thanks! I tried that but I get this error when I try and open my page...
Code: | Parse error: parse error, unexpected T_IF in C:\Program Files\Abyss Web Server\htdocs\index.php on line 3 |
any ideas why? _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sat May 15, 2004 5:54 pm Post subject: |
|
|
<?
$ref = $_SERVER["HTTP_REFERER"];
if ($ref == "http//forums.node1.tk")
{
header("location: /phpbb2/index.php");
}
else
{
include "main.php";
}
?> |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 6:03 pm Post subject: |
|
|
that got rid of the error, but it doesn't work... It still goes to my main page...
I tried this just to confirm that the referer is showing...
Code: | <?php
echo $_SERVER['HTTP_REFERER'];
?> |
and when I visit the with forums.node1.tk it shows forums.node1.tk
as a side not I figured out how to make an alias /forum that points to /phpBB2, looks better with /forum
edit: I got it kinda of working now!! it goes to my forums now when i type in forums.node1.tk but the page is all messed up... _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 6:51 pm Post subject: |
|
|
ok, I got it to work!! here's the code...
Code: | <?
$ref = $_SERVER["HTTP_REFERER"];
if ($ref == "http://forums.node1.tk/")
{
header("location: http://66.46.116.230/forums/index.php");
}
else
{
include "main.php";
}
?> |
I had to put the whole ip address in it for it to work... now it works great!!!
http://forums.node1.tk
can you verify that it is working??
Thanks!! :) _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server.
Last edited by Techno_Mage on Sat May 15, 2004 7:19 pm; edited 1 time in total |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 7:02 pm Post subject: |
|
|
Ok, now that's it working good... I'd like to know if I could take it a step further...
for example... say I have a bunch of /directories, could a script be made to automatically point to the corresponding directory if for example test.node1.tk was entered it would assume /test and go.. or if mysite.node1.tk was entered it would assume /mysite?
That way I could just make sub directories that would automatically be forwarded to if the subdomain matched the directory name?
Thanks! _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sat May 15, 2004 7:57 pm Post subject: |
|
|
Yes you can.
http://multiple-sites.tk is what most people use.
Oh, and I'm not sure that your forum script works.
Quote: | Notice: Undefined index: HTTP_REFERER in C:\Program Files\Abyss Web Server\htdocs\index.php on line 2 |
_________________ Bienvenidos! |
|
Back to top |
 |
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 8:23 pm Post subject: |
|
|
iNaNimAtE wrote: | Yes you can.
http://multiple-sites.tk is what most people use.
Oh, and I'm not sure that your forum script works.
Quote: | Notice: Undefined index: HTTP_REFERER in C:\Program Files\Abyss Web Server\htdocs\index.php on line 2 |
|
thanks for the info!
I was probably messing around with the site when you visited and that's why you got that error... it should be working now... if not let me know, thanks...
http://node1.tk my main site
http://forums.node1.tk my forums
Regards,
TechnoMage _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sat May 15, 2004 8:26 pm Post subject: |
|
|
No, forums still don't work. _________________ Bienvenidos! |
|
Back to top |
 |
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sat May 15, 2004 8:42 pm Post subject: |
|
|
Cool, glad to see its working! |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 8:58 pm Post subject: |
|
|
iNaNimAtE wrote: | No, forums still don't work. |
odd, I'll keep trying... does the rest of my site work? _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sat May 15, 2004 9:02 pm Post subject: |
|
|
Well the whole site works, but the redirect script you put in doesn't. I can't access the "Forums" page, because the URL is forums.node1.tk, and the script you are using doesn't work.
I just suggest using http://www.multiple-sites.tk for all your redirection. _________________ Bienvenidos! |
|
Back to top |
 |
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sat May 15, 2004 9:10 pm Post subject: |
|
|
I believe multiple-sites.tk allows full URLs with variables. Try it out and see if it works. _________________ Bienvenidos! |
|
Back to top |
 |
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sat May 15, 2004 9:52 pm Post subject: |
|
|
iNaNimAtE wrote: | I believe multiple-sites.tk allows full URLs with variables. Try it out and see if it works. |
I'm having trouble getting that multiple-sites script to work... but that's not surprising... i'm not very bright! lol
any luck with my forums yet? maybe you need to empty your cache and reload my site.. just guessing... _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sat May 15, 2004 10:08 pm Post subject: |
|
|
Cleared the cache, still doesn't work.
The instructions on Multiple-Sites are pretty self-explainitory. _________________ Bienvenidos! |
|
Back to top |
 |
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sat May 15, 2004 11:29 pm Post subject: |
|
|
It works for me.
http://node1.tk takes me to main page
http://forums.node1.tk takes me to forums
BUT i cant get it to work on my own .tk site. I can get it to work on all other framed pages except my .tk site. HTTP_REFERER is shakey at best when working with frames. I made similar scripts with perl and python and they worked great, until i used it with .tk. I wouldn't suggest using it. I Don't think adding query strings would work the way you would want it to.
Anyhow the node1.tk sites work for me and i think thats cool. But they may not for everyone. |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sun May 16, 2004 1:20 am Post subject: |
|
|
I'll probably just end up buying the domain for $10/year and then use zoneedit.. Then I'll be able to use some subdomains easily...
I changed the link on my menu that points to my forums to a normal /forums/index.php link... see if you can at least get to the forums now..
Thanks for all the help everyone! _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun May 16, 2004 2:10 am Post subject: |
|
|
Just a small note to those who don't know how VHC works , VHC checks the domain entered when the index.php file is read and depending on which domain was entered , it redirects to a different directory , now each domain has to point to your IP Address as an A record to get this script to work , try no-ip.com , they have A pointings and its free. Just a quick note again , your using a .tk domain which doesn't provide an A record so thats why its not redirecting to your forum area. |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sun May 16, 2004 3:50 am Post subject: |
|
|
Thanks for all the help.. I've decided to scrap the idea for now, if it doesn't work for everyone it's no good... So until I buy the domain name, it's just gonna be node1.tk
I cant seem to get that multiple-sites.tk to work... _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sun May 16, 2004 4:22 am Post subject: |
|
|
I'm too stubborn to give up on this... I'm still trying to get multiple-sites.tk script to work but I'm not having much luck...'
here's how my index.php script looks, can you tell me what I'm doing wrong?
my ip is http://66.46.116.230/index.php
my forums are at http://66.46.116.230/forums/index.php
my .tk url is node1.tk and I'm trying to make forums.node1.tk point to my forums...
here's my index.php
Code: | <?php
/*
Bluedog's Multiple Domain PHP Script
This script was created to help Abyss Web Server users so that they could host more than one site using
different domains and so I made it easier to program this script for their domains by creating a easy to use
site creator that can insert new domains instantly after hitting Submit Me!. Enjoy the script!
System Requirements:
1. Abyss Web Server (PHP Installed)
2. Alot of free domains or paid
Now Installation!
Go to your main htdocs folder and rename your index.html to index2.html. At the top of your Internet Explorer
browser , click on Edit than Select All, click on Edit again and this time click on copy. Open up NotePad and
click on edit than paste , save the file as index.php and put that file in your htdocs folder. Your Done!
*/
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "forums.node1.tk") {
//forward to appropriate page
header("Location : /forums");
exit;
}
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "") {
//forward to appropriate page
header("Location : /");
exit;
}
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "") {
//forward to appropriate page
header("Location : /");
exit;
}
//end duplicating, insert below.
//else show Main Page
else {
header("Location : /main.php");
exit;
}
?> |
thanks for any help... _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sun May 16, 2004 4:35 am Post subject: |
|
|
virtual host creator will not work unless the domain is directed to your IP. It will not work with framesets. |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sun May 16, 2004 4:45 am Post subject: |
|
|
Ok, I've been messing with this script and this is the result that seems to work.. can someone verify this??
Code: | <?php
/*
Bluedog's Multiple Domain PHP Script
This script was created to help Abyss Web Server users so that they could host more than one site using
different domains and so I made it easier to program this script for their domains by creating a easy to use
site creator that can insert new domains instantly after hitting Submit Me!. Enjoy the script!
System Requirements:
1. Abyss Web Server (PHP Installed)
2. Alot of free domains or paid
Now Installation!
Go to your main htdocs folder and rename your index.html to index2.html. At the top of your Internet Explorer
browser , click on Edit than Select All, click on Edit again and this time click on copy. Open up NotePad and
click on edit than paste , save the file as index.php and put that file in your htdocs folder. Your Done!
*/
//get domain entered in browser
if ($_SERVER['HTTP_REFERER'] == "http://forums.node1.tk/") {
//forward to appropriate page
header("Location : /forums");
exit;
}
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "") {
//forward to appropriate page
header("Location : /");
exit;
}
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "") {
//forward to appropriate page
header("Location : /");
exit;
}
//end duplicating, insert below.
//else show Main Page
else {
header("Location : /main.php");
exit;
}
?>
|
So, I'm not sure but it seems to work... anyone?? It kinda looks like the other script I tried although different...
http://forums.node1.tk
Thanks _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sun May 16, 2004 5:06 am Post subject: |
|
|
Yes That Works. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun May 16, 2004 7:14 am Post subject: |
|
|
I can't believe it , you actually got a .tk domain to
redirect , this is shocking , I thought this wasn't
possible at all to work, thats weird and im glad you
got it to work , VHC is the only thing closest to real
vhosting untill Abyss Pro comes out ! |
|
Back to top |
|
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sun May 16, 2004 8:33 am Post subject: |
|
|
I'm still having some problems though.. when I type in my IP address for the url in the browser.. http://66.46.116.230
I get this error message...
Code: | Notice: Undefined index: HTTP_REFERER in C:\Program Files\Abyss Web Server\htdocs\index.php on line 23
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Abyss Web Server\htdocs\index.php:23) in C:\Program Files\Abyss Web Server\htdocs\index.php on line 43 |
Any suggestions? _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sun May 16, 2004 7:04 pm Post subject: |
|
|
And it also seems, just as last time, that it works for eznetlinks, and it doesn't work for me.
Quote: | Notice: Undefined index: HTTP_REFERER in C:\Program Files\Abyss Web Server\htdocs\index.php on line 23
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Abyss Web Server\htdocs\index.php:23) in C:\Program Files\Abyss Web Server\htdocs\index.php on line 43 |
Maybe turn globals on...? _________________ Bienvenidos! |
|
Back to top |
 |
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Sun May 16, 2004 10:51 pm Post subject: |
|
|
iNaNimAtE wrote: | And it also seems, just as last time, that it works for eznetlinks, and it doesn't work for me.
Quote: | Notice: Undefined index: HTTP_REFERER in C:\Program Files\Abyss Web Server\htdocs\index.php on line 23
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Abyss Web Server\htdocs\index.php:23) in C:\Program Files\Abyss Web Server\htdocs\index.php on line 43 |
Maybe turn globals on...? |
pardon my ignorance, but how do I turn globals on? and what is globals? thanks _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Mon May 17, 2004 12:39 am Post subject: |
|
|
In your php.ini file (located in C:\Windows) search for "register_globals" and change the value to "On." _________________ Bienvenidos! |
|
Back to top |
 |
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Mon May 17, 2004 1:33 am Post subject: |
|
|
iNaNimAtE wrote: | In your php.ini file (located in C:\Windows) search for "register_globals" and change the value to "On." |
done! but what exactly does it do? I noticed it mentioned possible security risks... anyways.. let me know if it made any difference...
http://forums.node1.tk/
Thanks _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Mon May 17, 2004 2:52 am Post subject: |
|
|
No, still doesn't work. Global variables ("globals") are an old style of writing variables. For instance, $name is a global variable, as $_POST['name'] for a form field named "name" is not. _________________ Bienvenidos! |
|
Back to top |
 |
 |
Techno_Mage -
Joined: 09 May 2004 Posts: 57
|
Posted: Mon May 17, 2004 3:18 am Post subject: |
|
|
I wonder why it doesnt work for you...
I started a poll in this section to see how many people it works for and how many it doesn't... _________________ Regards,
TechnoMage
www.arenax.tk
ut2004://66.46.116.232:8888
Unreal Tournament 2004 RPG DM server. |
|
Back to top |
|
 |
|