homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

mod rewrite short.tld > very-long-domain-name.tld

 11:40 pm on Jun 5, 2010 (gmt 0)


We've got a site with a long domain which wants to use a short url (have short domain name) to link to every page on the long domain ie.

[short.tld...] > [very-long-domain-name.tld...]
[short.tld...] > [very-long-domain-name.tld...]
[short.tld...] > [very-long-domain-name.tld...]
[short.tld...] > [very-long-domain-name.tld...]

Both domains are hosted on the same private server.

Is there a standard rule that would accomplish this?
Since pages are constantly being generated on very-long-domain-name.tld, are there any existing tools/methods that can assign a unique short url to update real time?

Any ideas appreciated

Thank you



 12:09 am on Jun 6, 2010 (gmt 0)

It has to all be done within the PHP scripts on the site itself.

There's no way for
.htaccess to be able to know that a URL request for /UB349 refers to the internal filepath /folder305/folder18/filename38294.htm inside the server.

 2:20 am on Jun 6, 2010 (gmt 0)

If we're talking only about the domain name itself -- say, "www.very-long-domain-name-here.com" and you want to redirect some short domain name like "short.com" to that, then there may be a big mistake here before coding even starts.

Either promote the long domain name and link only to it, or promote the short domain name and link only to that one. You can do things like publish the short domain name in print and on TV/radio where the assumption is that it will always have to be typed-in, and then redirect those requests to the proper "branded" domain, but don't link to or promote any domain on-line that is not your "branded money-domain."

This is an SEO issue, best discussed in one of our search engine forums, but the bottom line is that if you promote and link to both domains on-line, then you are essentially creating "extra competition" for your own site in the form of multiple URLs competing for links and for search engine rankings. Plus, search engines take a dim view of a company that cannot make up its mind what it wants to be called on-line -- One company, one domain is the general rule, unless you are really huge (like General Motors with GMC.com and Chevrolet.com, for example).

Invoking a redirect from short.com to exquisitely-long-and-sinuous.com for every request also wastes your visitors' time and makes a mess of your logs and stats, because every initial client request results in a server response saying, "Nope, sorry. No can do. That resource has moved, please ask for it again at this new URL... This HTTP connection is now closed, Good-bye. Please call again soon." The client must then open a second HTTP connection and re-request what it wanted in the first place, now using the new URL provided in the server's redirect response... Big waste of time and bandwidth, and your "server hit count" essentially doubles. Both client requests get logged, skewing your stats, and Google and the other search engines will think that your site is a technical mess. This would likely constitute a "negative signal of quality" in their eyes.



 7:20 am on Jun 6, 2010 (gmt 0)

The use of the short url is required for Twitter. The short URLs will be tweeted and not used for other purposes but it's essential the longer main domain is used for general www & email, the short (not so user friendly as reader can't see much about file name or path) is just for tweeting.

Surely a lot of sites are already doing this?

Thank you for your comments.


 7:40 am on Jun 6, 2010 (gmt 0)

Twitter doesn't require short URLs these days.

They will auto-shorten anything over 138 characters, however if your URLs are already quite long you'll want to shorten them to leave room for the rest of the message.

You'll need a script that looks in the database for the new URL when a short URL is requested, and then sends the HTTP 301 redirect header pointing to that new location.


 7:50 am on Jun 6, 2010 (gmt 0)

The 140 character limit tweet will include both the short url and the tweeters comment (so needs to be extra short). Thanks for the comments.


 8:05 am on Jun 6, 2010 (gmt 0)

I was just clarifying that "The use of the short url is required for Twitter." means that you are "using short URLs with Twitter" and not "Twitter requires short URLs".

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved