GetDotted Domains

Viewing Thread:
"Short URLs"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Tue 16/12/08 at 20:46
Regular
Posts: 19,415
I heard Garin quit the forum, that's a real shame, he'll be missed :(

Okay not that I use it (yet) but is it possible to do something like tinyurl on twitter? So instead of using tinyurl.com I create http://markswebsite.com/gh7 to direct users to a page on my site. That way I don't have to give out long urls in emails, twitter, facebook etc and I don't have to advertise tinyurl.

So is this a good idea and something I could do? Tinurls expire too right?

Thanks guys, merry christmas!
Mon 19/01/09 at 05:27
Regular
Posts: 19,415
Oh cool I got some helpful advice after all, thanks guys, I really appreciate it :D I'll give it a try later on today. Great timing too as I just registered my tinyurl.com clone. Only 6 characters too :)
Sun 18/01/09 at 14:35
Regular
"It goes so quickly"
Posts: 4,083
Any luck Machie?
Thu 01/01/09 at 22:03
Regular
"It goes so quickly"
Posts: 4,083
As expected, I made a mistake with the syntax, as it seems you need to also add a slash to the end of the short code to get it to work in the .htaccess file. I've updated the sample in my previous post. I've also added the 301 redirect code, so that the actual address is the one used, and not the short address, so that the proper address gets all the glory.

You may also want to try a single PHP file called "re.php" or something, and place within this file the code:

<?php
if (isset($_GET['web'])) {
$addr = trim($_GET['web']);
$shortcodes = array();
$shortcodes["[B]ah7[/B]"] = "[B]chaper/4.htm[/B]";
$shortcodes["[B]bj5[/B]"] = "[B]page/7.htm[/B]";
$shortcodes["[B]cjh[/B]"] = "[B]the/man.htm[/B]";

foreach ($shortcodes as $name=>$value) {
if ($name == $addr) {
header($_SERVER['SERVER_PROTOCOL']." 301 Moved Permanently");
header("Location: http://markswebsite/".$value);
exit;
}
}
header($_SERVER['SERVER_PROTOCOL']." 404 Not Found");
} else {
header($_SERVER['SERVER_PROTOCOL']." 404 Not Found");
}
?>


... and within your .htaccess file, include the lines:

RewriteEngine on
RewriteRule ^web/([^/.]+)$ http:///markswebsite.com /re.php?web=$1
RewriteRule ^web/([^/.]+)/$ http://markswebsite.com /re.php?web=$1


This will then redirect any web address that starts with http://markswebsite.com/web/ to the re.php file, with anything after the URL being placed as a query string, which means anything like http://markswebsite.com/web/ [B]ah7[/B] will end up as http://markswebsite.com/re.php?web= [B]ah7[/B], where [B]ah7[/B] is you desired short URL.

Within the PHP file, you should see an array has been created that contains the short URL as the array name, and the real web address as it's value. Just add / remove as desired in this area to make your short URL redirects.

The reason I've added the [B]/web/[/B] part is because I'm not advanced enough in .htaccess URL manipulation to get it done from the root directory, sorry again.
Thu 01/01/09 at 10:15
Moderator
"Are you sure?"
Posts: 5,000
As cjh, mentions there are a few solutions to this.
.htaccess, php, javascript and php/mysql can all be used.

Machie wrote in the past about having 3 or 4 hundred sub domains on the go so he might need to go for a MySql solution to make things manageable!

Google your own tinyurl code for more ideas...



I didn't like to reply before as I thought Machie only wanted to hear from Garin...

Search Freeola Chat
Wed 31/12/08 at 23:11
Regular
"Feather edged ..."
Posts: 8,536
Hmmm... wrote:
> Glad to see you got your website running in the end.
>
> You look different in the pictures than I imagined :¬P
>
>
>
>
>
>
>
> Search Freeola
> Chat


Like the quad bikes:-)

So where did Garin go....?
Wed 31/12/08 at 19:22
Regular
"It goes so quickly"
Posts: 4,083
It seems like a good idea to me, and is certainly do-able. I've never done it myself, so don't have a quick solution for you, but a small and simple solution would be to create a .htaccess file with the redirects contained in there, such as:

RewriteEngine on

RewriteRule [B]gh7/[/B] [I]http://markswebsite.com/page/one.html[/I] [B][R=301][/B]
RewriteRule [B]ad6/[/B] [I]http://markswebsite.com/section/two.html[/I] [B][R=301][/B]


... which should take care of what you're after, though it has been a while since I've played with URL re-writing, so that syntax may be slightly inaccurate, sorry.

Alternatively, you could create an index.php with the code:

<?php
header($_SERVER['SERVER_PROTOCOL']." 301 Moved Permanently");
header("Location: http://markswebsite.com/[B]section/two.html[/B]");
?>


... and creating a folder with the short name you want to use, so that a folder called "ad6" contained the index file above, and whenever someone goes to http://markswebsite.com/ad6, the index.php file is loaded, and redirects to the larger URL.

For each folder you create, you'll need to alter the URL in the index.php file to correctly reflect your desired redirect. It may also become a pain to maintain if you have a large number of redirects.
Wed 17/12/08 at 10:20
Moderator
"Are you sure?"
Posts: 5,000
Glad to see you got your website running in the end.

You look different in the pictures than I imagined :¬P







Search Freeola Chat
Tue 16/12/08 at 20:46
Regular
Posts: 19,415
I heard Garin quit the forum, that's a real shame, he'll be missed :(

Okay not that I use it (yet) but is it possible to do something like tinyurl on twitter? So instead of using tinyurl.com I create http://markswebsite.com/gh7 to direct users to a page on my site. That way I don't have to give out long urls in emails, twitter, facebook etc and I don't have to advertise tinyurl.

So is this a good idea and something I could do? Tinurls expire too right?

Thanks guys, merry christmas!

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

First Class!
I feel that your service on this occasion was absolutely first class - a model of excellence. After this, I hope to stay with Freeola for a long time!
My website looks tremendous!
Fantastic site, easy to follow, simple guides... impressed with whole package. My website looks tremendous. You don't need to be a rocket scientist to set this up, Freeola helps you step-by-step.
Susan

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.