Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to best handle shortcut / vanity URLs

Posted on 2011-03-14
2
Medium Priority
?
370 Views
Last Modified: 2012-05-11
I'm trying to write a script that will effectively be a purposeful precursor to a 404 page.  Essentially, I'd like to create a mechanism for managing vanity/shortcut URLs that don't exist as real pages/paths.   For example, if someone were to come to my site by typing http://mysite.com/shortcut it would gracefully redirect to http://mysite.com/somePath/someDeeperPath/somefile.cfm.

Up until now I have been creating http://mysite.com/shortcut/index.htm with a meta refresh to the longer path.  I'd like to create a short script that will somehow be processed whenever someone enters my site (if possible) or alternatively in the head section or template of my 404 page, that will examine the intended path that a user typed or linked to, see if it exists, and if not, loop through a file containing several predefined vanity/shortcut URLs, and if it finds a match, go to the corresponding path.  And of course if not, then handle as a 404 error.  

Is there an easy way to examine the intended path/URL and verify that is a valid URL on the server?  As I think through my logic as I write this, clearly the path wouldn't exist if it got to the 404 page in the first place.   So then, is it possible or advisable to tinker with my 404 page in this capacity?  Or is there a better way to handle and manage shortcut/vanity URLs without creating a file with a refresh in the head section?

I really want this to be a process I can code rather than make a redirect at the web server level, so that I can build an interface where my content contributors can hopefully add vanity/shortcut URLs as name-value pairs in some sort of interface I'll create.
0
Comment
Question by:benjaminfam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
RickEpnet earned 1500 total points
ID: 35132792
The easiest thing is to use this I love this product and they have a free version of it. Not exactly what you are asking for but I think it will work.

http://www.helicontech.com/isapi_rewrite/
0
 

Author Closing Comment

by:benjaminfam
ID: 35258808
Like you said, it isn't exactly the solution I was hoping for, but apparently it's the best option.  Thanks for trying.
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question