Over the course of the past couple of months there have been a number of questions that popped up on the mura forums regarding URL masking and redirects. I found myself copying & pasting the same snipit of code for a handful of different users and finally decided that I would take a couple extra minutes to turn it into a plugin and add it to the mura app store.
The concept is incredibly simple. Once the plugin is installed you can navigate the extended attributes of any page and define an "Alternate URL". This can be used for creating marketing friendly short URL's, or setup simple 301 redirects to map old links to new pages.
For example if you have a page like this is mura: http://www.myDomain.com/my-services-section/my-special-services/cool-service/
You can just setup "cool" as an alternate URL so the link will look like this: http://www.myDomain.com/cool/
You can also define if you would like to do a standard redirect, 301 redirect, or no redirect but pull the correct content. I should say that it is important to note that this plugin doesn't use the 404 event handler to manage these redirects. That way any other plugins that tie into the 404 handler for logging ect will not be fired because this isn't a true 404. Also, by doing the redirect at the top of the lifecycle it improves performance on these requests.
You can find the plugin in the app store here: http://www.getmura.com/app-store/apps/url-tools1/
And feel free to fork, feature request & log issues here: https://github.com/gregmoser/muraURLTools
Please let me know if you have any ideas for improvements, I am happy to build out additional functionality into this simple plugin.
Comments
- Christian Ready Posted: June 3, 2011, 6:58 PM
-
Thanks for putting this together. I'm looking forward to trying it out. Unfortunately I tried downloading it from the App store and got a 404 error.
Enjoying the irony :)
- Greg Moser Posted: June 3, 2011, 7:25 PM
-
Wow, that is a fantastic piece of irony... Well until the link gets fixed in the app store, you can download it directly from github here:
https://github.com/gregmoser/muraURLTools/zipball/master
Thanks for the heads up on this.
- Christian Ready Posted: June 3, 2011, 7:40 PM
-
Thanks Greg. I am getting some errors. Should I post them here or on GitHub?
- Greg Moser Posted: June 3, 2011, 7:42 PM
-
Posting any errors on github would be great... be sure to note the version of mura you are using and the version of Adobe Coldfusion or Railo.
-Greg
- Christian Ready Posted: June 3, 2011, 8:03 PM
-
Ok, thanks. I just added my error to GitHub
- Michael Sharman Posted: June 5, 2011, 11:09 PM
-
That looks cool, as an interesting comparison FarCry has the concept of "FriendlyURLs". You can have 0-many custom FU's per unique objectId (i.e. a page).
- Greg Moser Posted: June 6, 2011, 5:17 PM
-
@Michael
Ya, a lot of CMS systems have this notion of "Friendly URL's" and in fact i believe that Mura may even have 'some' functionality built in. In fact adding support to do many URL's per page is something that I was almost sure would be an enhancement once someone requested it.
At the end of the day I hope that developers will come up with some cool additional feature requests that can make this tool even better (after all right now it's not very exciting).
Thanks for the feedback.
- Christian Ready Posted: June 6, 2011, 5:20 PM
-
Can you explain the difference between "no redirect", "redirect" and "301 redirect" ?
- Greg Moser Posted: June 6, 2011, 5:37 PM
-
@Christian
Sure, here is an explanation of each.
No Redirect: This means that when someone navigates to the alternative URL, the content from the base page is displayed to the end user without having the actual page do a redirect to the original URL. While this option will be faster because there is only a single request involved, it will be seen by Search Engines as Duplicate Content which can be a concern. This is because at the end of the day you will have two separate URL's that display the exact same content.
Redirect: This option is very simple, basically the plugin uses a cflocation to redirect the request to the pages default URL. This avoids the issues of Duplicate Content.
301 Redirect: This option is just like the previous redirect, except that a "301" status code header gets added to the Redirect so that the browser / crawler knows that this resource has been permanently moved. This is a great option if you are migrating URL's from an old site to a new site. It will force the search engines to update their index.
For more information on the 301 header you can read about the spec on the W3's website here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
It is under the heading of:
10.3.2 301 Moved Permanently
- John Sieber Posted: June 6, 2011, 7:05 PM
-
Cool plugin idea, and one I will surely be using with the Mura site that I am developing. Thanks for the contribution to the community.
- Sharon Posted: June 14, 2011, 4:02 PM
-
This is fantastic stuff. I was hoping to avoid mod_rewrite as much a possible (not that I don't love spending days in a regex fog.)
- Kevin Posted: September 2, 2011, 4:21 PM
-
Greg, thanks so much for making this available. I am receiving an issue when deploying the plugin.
Could not find the included template /plugins/7/plugin/config.xml.cfm.
I am using the 1.2.1-2-g81f742a.zip version of the plugin, Coldfusion 9, and 5.4.4144 cire 5.4.4001 site. Any ideas what might be going on?
- Greg Moser Posted: September 2, 2011, 4:39 PM
-
@Kevin, so first and foremost I recommend downloading the latest and greatest version 2.0 here: https://github.com/gregmoser/muraURLTools/zipball/master
Also, you are going to need to update mura for that .zip file to work. In older versions of mura github .zip files didn't work because there is a main folder in the top directory and then the actual plugin information is one directory lower than mura wanted it to be.
That said, you can either download the zip, drop down a folder and re-zip it... Or you can just update mura which now looks recursively through the install for a plugins folder.
Hope that helps.
- ~Angela Posted: September 21, 2011, 2:08 PM
-
Hi Greg,
So far so good with URL Tools. Thanks!
I have an enhancement request for you... You know how in Mura you can put a page called 404 at the top level of the site ({sitehere}/404/) in order to create your own custom 404 page? Well, I'm not fond of having it in the top level like that so I would like to create a grouping of error pages like this: /errors/404/ and /errors/500/
I figured if I use URL Tools on /errors/404/ so that it's /404/ it would work. Unfortunately it doesn't. :-/ Seems Mura is intercepting it before URL Tools has a chance to do its thing.
Would be nice to be able to get URL Tools to work with /404/!
Thanks,
~Angela
- Greg Moser Posted: September 22, 2011, 4:11 AM
-
Hey Angela,
I'm glad to hear that the URL tools plugin is working for you. Actually I didn't know that you could do a custom 404 page in mura like that (learn something new every day). Seems like this is a pretty reasonable request, but I just need to spend some time to wrap my head around it. Will you do me a favor an open up an issue on github for this feature request? (https://github.com/gregmoser/muraURLTools/issues)
Thanks!
- ~Angela Posted: September 22, 2011, 1:36 PM
-
Hi Greg,
Oh cool; so glad to teach you something new. :-) I will definitely add that on github for you Thanks for considering it.
~Angela
- Tom Sucaet Posted: September 26, 2011, 5:59 AM
-
I don't know if this is a bug, but when I delete my 'redirect' (= delete my Alternate URL) the redirect is still working.
Any idea?
- Greg Moser Posted: September 27, 2011, 4:15 PM
-
Hey Tom, that seems very strange... so you are saying that after you delete all of the alternate URL's from the extended attributes, that there is still a redirect happening when you navigate to it?
What version of URL Tools are you using? Can you open up an issue on the github tracker for me? (see 3 comments above for link)
-Greg
- Tom Sucaet Posted: October 5, 2011, 2:23 AM
-
I was using version 1.2.1, I've upgrade to 2.1 but the problem remains. I've added an issue on Github.
Tanx, Tom
- Donna Posted: January 12, 2012, 12:58 PM
-
I just tired this on one of our test sites & got the following error
struct
ErrorCode 1064
Message You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 a.attributeValue FROM tclassextenddata a INNER JOI' at line 5
SQLState 42000
We are using
Core Version 5.6.4746
Site Version 5.6.4185
Is there a fix?
Thank you,
Donna
- Christian Ready Posted: January 28, 2012, 6:02 PM
-
This might not be what you had in mind for this plugin, but what if we introduced the ability for the user to define URLs that would redirect *to* the page they are defining the URLs on?
For example, I have a customer that wants to create referral URLs for customers (e.g., mysite.com/ref/customer1) which would then redirect to the home page and mura traps the "customer1" as a session variable for use during the session (e.g., in a Welcome, customer1" message)
Is that doable? I'm playing around with your plugin but I confess I'm still a plugin n00b :)
- Greg Moser Posted: January 29, 2012, 11:22 AM
-
@Christian,
So I've actually thought about this functionality quite a lot. I was thinking of doing a UI inside of the plugin. That screen would show you all of the alternative URL's you have setup on individual pages (which will help with managing potential duplicates).
Also this new section would allow you to create fully qualified redirects that might not end up on the site even. For example lets say you wanted to have http://www.mysite.com/buymybook automatically redirect to http://www.amazon.com/?product=123&affiliateid=456
I think that example would also allow for you to do exactly what you need as well.
One of the other ideas i have been toying around with is hooking in to Google analytic so that you can have nice clean landing page URL's like http://www.mysite.com/januaryPromo and then specify all of the google analytic campaign variables like utm_source and utm_campain behind the scenes without the need to append to the URL.
Also, it might make sense to build in simple QR Code management so that you can keep track of all the QR Codes your company has set up and where they redirect to.
With all of this in mind, I think the real question now is how to execute all of these goals with the most flexible architecture and UI. Setting Cookies and JavaScript variables are really at the heart of a lot of these tasks so things like the google analytics tie-in might be able to be slightly abstracted to accomplish a lot more goals.
Just some ideas, I'd love to hear feedback with any thoughts.
-Greg








