Link to home
Start Free TrialLog in
Avatar of brothertruffle880
brothertruffle880Flag for United States of America

asked on

Setting up an easy-to-remember URL which leads to a longer URL.

I need to set up a easy-to-remember URL like www.mycompany.com/PRODUCTX
However, the actual location of PRODUCTX may change.
1. What is this called:  The process of setting up a easy-to remember URL which leads to an actual URL whose address may contain a bunch of letters and numbers, etc.
2. Is it called a primary URL?  Destination URL?
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Generally it is URL rewriting - although there are services out there like Bitly that provide this service.

You can setup rules in your .htaccess (or similar) file to specify how the incoming URL is "rewritten" to be the equivalent internal URL
That called shortened url there is several free services out there that provide this process for you (shortify your long url and track it).

If you want your own service version, the short answer is : attaching a short string with the reel link so when you recieve the request you'll be able to detect/decode the short string and redirect to the long one (here you could save all the tracking info before the redirection).

I'm not sure which language you're using but you could take a look to this PHP example.
Avatar of brothertruffle880

ASKER

Hi All;
I'm familiar with BITLY and other link shorteners.
I think my request is simpler.
I want www.mycompany.com/PRODUCTX
to be redirected to www.mycompany.com/product_number_1232868123_wintercollectionACD_sourceA
There will be times in the future when the short URL will be sent to another destination such as:
www.mycompany.com/product_number_1232868123_spring2019collectionACD_sourceXXX

If I give the customer a simple link, they can bookmark it and then no matter how I change the ultimate destination, the user still sees and can use the simplified link.

Is this technique called "URL redirecting"? "URL Proxy"? "URL alias"?  
I don't want to sound like a doofus when I"m talking to developers.
Who owns www.mycompany.com?
What runs on it?

However, the actual location of PRODUCTX may change.
Shortened URL services generally do not give you this option without premium or signup

URL rewriting it closer to what you want

You can run your own short URL service (keep it private otherwise you will be fighting with blacklistings)
https://github.com/YOURLS/YOURLS
What version of SharePoint are you using? If you are on SP13 or higher you can check the App Store, there are a handful on there.

You can pick and choose which sites, libraries, lists, etc to shorten.

It will do the URL rewrite (shortening) for you without having to mess with any system files.  
It should also update if you change the parent url, however I never tested that.

But it will auto generate the url, just like bitly and others do.  

I believe a paid version will allow you to customize the url.  If not, you may have to go custom like suggested.
What version of SharePoint are you using?
Did I miss something?
I want www.mycompany.com/PRODUCTX
to be redirected to www.mycompany.com/product_number_1232868123_wintercollectionACD_sourceA
.htaccess
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ product_number_$1_wintercollectionACD_sourceA [L,NC,QSA]

Open in new window


BUT there is a potential problem here - primarily with the '_wintercollectionACD_sourceA' part.

That seems to be product specific text that might be different for each products.

.htaccess rules can only work with what they are given - you can take parts of the incomming URL and construct a new URL with those parts (and other text).

If you have a product that ends summercollection then this won't work as there is not enough information in the incoming URL to create the correct internal URL.
I'm not sure which language you're using but as an example using php if you've a route for `www.mycompany.com/PRODUCTX` that lead the user to X.php script/action you've just to redirect the request from there where you want :

<?php
    header("Location: www.mycompany.com/product_number_1232868123_wintercollectionACD_sourceA", true, 301);
    exit();
?>

Open in new window


Inside the script you could change the redirection link any time you want when the `/PRODUCTX` still the same.
Important Note:
header: location is a header redirect - it WILL change the URL in the address bar

If you want to keep the shortened (user friendly) URL in the browser address bar but display the contents from a differently addressed internal script you need to ReWrite the URL.
You may have right.

But I'm not sure, from my experience with "bitly" and google shorten "goo.gl" they always redirect to the long path...
But I'm not sure, from my experience with "bitly" and google shorten "goo.gl" they always redirect to the long path...
They will - but that is because they are redirecting to a different domain / server.

It depends on what the requirement is - if you just need a short URL and don't care about where it resolves then bitly and the like are fine.

If you want to construct friendly URL's that make internal (complicated) url's look simpler then rewriting is the way to go.
I think I may have miscommunicated my request or goals.
I'm using HTML BTW. The web site is mine, belongs to me.
My goal is not necessarily a short URL.  It is an unchanging URL that the customer/web visitor can bookmark which leads to a changing destination. Example:  www.sitename.com/page1  This is what will be bookmarked by the user.
When they click on that hyperlink however, they will be taken to another page within the same site.  This final destination page on the same site will change over time.
The customer/user will see a simple URL if they click "Copy shortcut" on my hyperlinked text.    Thus, they can set up an icon or place it in the bookmarks.
However, once the customer clicks that unchanging URL, they will be directed to a product or information page.  This product/information page URL will change regularly.
Is this called a redirected page?  or a page redirect? Or a proxy page?
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In this case I would suggest the use of simple jQuery script to load the page you want so you need just to change the name of your new product page content and it will be loaded dynamically.
<html> 
  <head> 
    <script src="jquery.js"></script> 
    <script> 
    $(function(){
      $("body").load("new_product.html"); 
    });
    </script> 
  </head> 
  <body> 
  </body> 
</html>

Open in new window


If you have the full page not just the content you could load just the body of page like :

$("body").load("new_product.html body"); 

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial