For a small site, no one ever buys a domain for it. (Normally) You'd normally use say a .tk or .owns.it or .cjb.net - well you get the drift. The only problem is to an experienced computer user that’s a no good sign - Your website in a frame.
I have thought up a great idea in bed a few days ago were you can keep your site in the .tk frame and sort of not be in the frame as you can add stuff to the address afterwards. Basically going to
www.site.tk/news.html will change the frame address it
www.geocities.com/site/info/~pages/news.html or whatever your large address is. And this will work with any redirection. No way....Yes way!
How:
It works in a 3 step process:
Redirection Page > Page Identification > Page
The '
Redirectrion Page' is the
www.site.tk. Now when you set your redirection page make it send you to the '
Page Identification'.
All the good stuff is stored in the '
Page Identification' area. Basically with PHP you can identify the page you were linked from - in this case the '
Redirection Page'. So in our about sample it would be
www.site.tk/news.html. Then using a few methods we can remove the
www.site.tk/ and were left with
news.html. Once it go that it Opens the '
Page' that in this case will be '
news.html' and you have your site. Easy and real handy
Why:
Really... there isn’t much use - just looks i guess. I hate it when i want to copy the URL of the page and it’s in a frame, never again with this script. Also if someone remembers 'hey, i don’t want to go all the way thorough the site, i want to go rite to the news' he could just type
www.site.tk/news.html were with the normal way he couldn’t do that.
You can turn your redirection into your own domain.
Setup:
Ok, well to start when you set up your redirection make it redirect to the '
Page Identification' and in this we will call it say
pageident.php. So it will be something like this:
www.geocities.com/site/info/~pages/pageident.php.
Next paste this into
pageident.php: (ill explain it all soon, just follow me for now)
| Code: |
<?php
###Only Change the next 2 lines:###
$base = 'www.site.tk/'; #NOTE: Do NOT add http://
$index = 'index.html'; #NOTE: Do not add the domain (EG: www.site.tk) or slash at start (/)
$error = 'error.php';
###Do not edit pass if you dont know what your doing!###
$ref = $_SERVER['HTTP_REFERER'];
$url = str_replace($ref,'',$base);
$url = str_replace('http://','',$url);
if( $url == '' ) {
include($index);
}
elseif( file_exists($url) ) {
include($url);
}
else {
include($error);
}
?> |
Once you have done that edit the 2nd, 3rd and 4th line with your website 'base' WITHOUT http://, the index page for if someone just went to www.site.tk with out anything after it and a error page if the page can not be found. You may also set the error page to the index if you want it just to go back to the index if it’s not found.
Finally change all the links on the 'page' from something like this:
| Code: |
| <a href='news.html'>News</a> |
To this:
| Code: |
| <a href='news.html' target='_top'>News</a> |
But also note if you’re using some sort of command like <base> you will have to change it to this:
| Code: |
| <a href='http://www.site.tk/news.html target='_top'>News</a> |
That it safer. So your better using that if you’re not sure.
Explanation:
Now i will explain the code for the 'Page Identification'
The first 3 lines of code are Vars that you have to change to your needs. You already know about them.
The 4th line of code is where we store in a Var were you were linked from.
On the 5th line we remove the var $base from the linked page by using Find and Replace and replacing it with nothing.
Next we separately remove http:// using the same method. We do them both separately because if someone goes to www.site.tk/news.html not http://www.site.tk/news.html It will not replace it as there is no http:// it can find - and if they were both together it would also not replace the www.site.tk.
In the next 3 lines it says If there was no page after www.site.tk/ open the index page.
In the next 3 lines its saying if the first statement isn’t true ^^ and the page after www.site.tk/ exists open it.
Finally it says well if both of these statements are not true then the page must not exist - so it opens the error page.