PDA

View Full Version : How can I redirect one URL on my domain to another?




newappleboy
Jan 5, 2010, 12:17 PM
Afternoon all!

I'm hoping someone can help me with a goofy request. My domain is through GoDaddy and the blog I host there is done through WordPress. For FTP purposes I use Cyberduck. Hopefully this info helps in some way with my actual request.

I have a URL on my blog that is quite lengthy, but is the source of the greatest traffic to my site, seen below:

http://www.therealjamesdean.com/2009/07/01/the-name-of-the-game-is-prius/ (http://therealjamesdean.com/2009/07/01/the-name-of-the-game-is-prius/)

It was something goofy that some friends and I thought up, and after some facebooking and digging (http://digg.com/d3vSoP), and just word of mouth, apparently the page has spread around because I get hits all day every day on just that one page. I'd like to have a much shorter URL to be a kind of front-runner to the same page if possible. For instance...:

http://www.therealjamesdean.com/Prius

As you can see, going to it shows the amateur amount of code I tried to find on the internet to process the redirect, but it doesn't do anything. Likely my fault, but I need help figuring out how to correct it. Another thing I noticed is that if you type in "/prius" instead of "/Prius" you get an error. I could've sworn the internet wasn't type specific. :p

Can anyone help me? Pretty please? I just want the shorter URL to be typed in and instantly pull up the actual page with the longer URL. Is this even possible with things setup as I do? Thanks in advance!



swiftaw
Jan 5, 2010, 12:25 PM
Firstly, yes, there is case sensitivity.

Secondly, looking at your page you put all your "code" in the body so it's not code just text. Here is the full source code of your webpage:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.25">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Arial}
</style>
</head>
<body>
<p class="p1">&lt;html&gt;</p>
<p class="p1">&lt;head&gt;</p>
<p class="p2">&lt;meta HTTP-EQUIV="REFRESH" content="0;url=http://therealjamesdean.com/2009/07/01/the-name-of-the-game-is-prius/l"&gt;</p>
<p class="p2">&lt;/head&gt;</p>
<p class="p2">&lt;body&gt;</p>
<p class="p2">&lt;/body&gt;</p>
<p class="p2">&lt;/html&gt;</p>
</body>

what is should be is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="REFRESH" content="0;url=http://therealjamesdean.com/2009/07/01/the-name-of-the-game-is-prius/"></head>
<body>
</body>
</html>

newappleboy
Jan 5, 2010, 12:38 PM
Thanks for the info, I'll give it a try when I get home this afternoon. What's funny is the code you provided is exactly what I typed in and saved as an HTML file from TextEdit. Guess it wasn't as basic as I thought. I used to do all my code editing in notepad on a PC, so this was my first time trying to tweak anything on the mac.

And I guess if it's case sensitive I should create both a Prius.html and a prius.html page for the redirects. Right? Thanks!

swiftaw
Jan 5, 2010, 12:43 PM
Thanks for the info, I'll give it a try when I get home this afternoon. What's funny is the code you provided is exactly what I typed in and saved as an HTML file from TextEdit. Guess it wasn't as basic as I thought. I used to do all my code editing in notepad on a PC, so this was my first time trying to tweak anything on the mac.

And I guess if it's case sensitive I should create both a Prius.html and a prius.html page for the redirects. Right? Thanks!

In TextEdit, make sure that Preferences->Open and Save->Ignore rich text commands in HTML files is checked.

angelwatt
Jan 5, 2010, 12:44 PM
Another route than the meta tag, is to use an Apache .htaccess (http://httpd.apache.org/docs/1.3/howto/htaccess.html) file, if your host supports it. Then you can do a redirect like so,
Redirect 301 /2009/07/01/the-name-of-the-game-is-prius/ http://www.therealjamesdean.com/Prius

One issue, with either solution, is that the current URL is the one being passed around, so it's the one likely to continue to be used. So, I'm just not sure what you're hoping to accomplish with the redirect. Maybe just a simpler URL to give out?

The reason your file didn't save right was because TextEdit saved it as rich text rather than plain text. You should use a code editor dealing with code so not to worry about this type of thing, like TextWrangler or Smultron.

mstrze
Jan 5, 2010, 12:50 PM
How about a renaming site like tinyurl?

www.tinyurl.com


The link never expires and comes up with a short link. Sure, it's not memorable, but it's short. ;)

And if it IS just being sent around...why the need to shorten it at all? Heck, your domain name is difficult to type/remember to begin with. Do you really think someone will type in the whole URL? Even a shortened version?

Just playing devil's advocate...

newappleboy
Jan 5, 2010, 01:06 PM
In TextEdit, make sure that Preferences->Open and Save->Ignore rich text commands in HTML files is checked.

Thanks! I'll edit my preferences to make sure this doesn't happen again. :-)

Another route than the meta tag, is to use an Apache .htaccess (http://httpd.apache.org/docs/1.3/howto/htaccess.html) file, if your host supports it. Then you can do a redirect like so,
Redirect 301 /2009/07/01/the-name-of-the-game-is-prius/ http://www.therealjamesdean.com/Prius

One issue, with either solution, is that the current URL is the one being passed around, so it's the one likely to continue to be used. So, I'm just not sure what you're hoping to accomplish with the redirect. Maybe just a simpler URL to give out?

I read about the .htaccess method, but I'm not sure how to implement it on GoDaddy. I guess more Googling is in order. And yes, I'm just wanting a shorter URL to give out.

How about a renaming site like tinyurl?

And if it IS just being sent around...why the need to shorten it at all? Heck, your domain name is difficult to type/remember to begin with. Do you really think someone will type in the whole URL? Even a shortened version?

Just playing devil's advocate...

I appreciate the candor, but I disagree. I use tinyurl for a lot of things, but when it comes to my own domain I try to keep the links with my domain in them for recognition at first glance. Granted, it's not the shortest domain, but I'd like to think that it's at least moderately memorable. That's why I'm trying to implement the redirect so I can reference the popular entry with my domain and a much shortened ending. lol

mstrze
Jan 5, 2010, 01:15 PM
I appreciate the candor, but I disagree. I use tinyurl for a lot of things, but when it comes to my own domain I try to keep the links with my domain in them for recognition at first glance. Granted, it's not the shortest domain, but I'd like to think that it's at least moderately memorable. That's why I'm trying to implement the redirect so I can reference the popular entry with my domain and a much shortened ending. lol


I would be interested to see how much traffic is funneled through this new shorted web address. Let us know how many hits it gets...to let others know if this was worth it.

I still say most folks are going to click on a link, and not type it in...especially with a domain name as large as yours is. Heck, I can't recall the last time I typed in an entire URL including info after the / . Maybe 15 years?

angelwatt
Jan 5, 2010, 01:42 PM
I read about the .htaccess method, but I'm not sure how to implement it on GoDaddy. I guess more Googling is in order.

It's just a matter of copying and pasting that into a new document and naming the file .htaccess (no other extension). Then you'll upload it to your web host and put it in your document root folder (where you web files go). As long as the host is running an Apache web server.