Advice: Trigger to build redirect assets?

Hi everyone,


I'm just after some advice on the best way to set up redirects for every page in a website, this is what I want to do:



Our old cms has unique urls for each page and automatically allows short urls for every page, eg:

www.domain.co.uk/section/sub-section/pageone

www.domain.co.uk/section/sub-section/another-section/pagetwo



automatically are available as:

www.domain.co.uk/pageone

www.domain.co.uk/pagetwo



So, we have an unknown number of page urls in print and as incoming links to these short urls. Our site is now running in Matrix, so we need to set-up a redirect for every page on the site from a short url to the new full url in Matrix.



What is the best way to do this?

Can I set up a trigger that will create a redirect asset for every page, the redirct will sit at the site root, and will redirect to the pages full url? Then run this trigger for all exisiting pages, and leave it running on a Page Published event for all new pages.

Will that work?

Is there a better way of doing this?



Thanks for your thoughts and advice!

Charlie.

Hey there Charlie,


Do you have a fixed amount of redirects in the system and will you be adding more? If it's fixed I would assume you could get passed this move by doing a re-direct exercise and doing a bulk CSV redirect when needed…

Hi Duncan,


I have a fixed number at the moment - all pages in the site, but I think the team are keen to keep this functionality (it is very handy when sending out press-releases, print material etc to have the short urls) so they would like a redirect automatically created for all new pages as well.



But, I might be able to persuade them that future pages could be done manually, if there's an easy way to do the one-off job?



Thanks!

Charlie.

Right, I guess it comes down to your approach and how you're implementing the system on your side.


If you were going down the remapping route I would assume the first thing would be to spend a bit of time and do a full remap of the system. This would take all the fixed redirects you have and point them in the system. You can do this quickly with a CSV file:


    	
    You can also upload a CSV file of remap URLs to add to the system. The format for each line must be:
    "oldURL, newURL, expiry date (yyyy-mm-dd hh:mm:ss),never delete option (0 or 1)"
    Example 1 (never delete(OFF)): http://www.mysite.com/page_1, http://www.mysite.com/home, 2003-17-12 10:27:00, 0
    Example 2 (no expiry date and never delete(OFF))): http://www.mysite.com/page_1, http://www.mysite.com/home, , 0
    Example 3 (no expiry date and never delete(ON)): http://www.mysite.com/page_1, http://www.mysite.com/home, , 1


That works really well. And I'm sure you might be able to use the 'add remap' trigger to find ways to get the future ones remapped (this could get messy).

I would probably look at it another way: If you're not needing this to be an Apache 301 and could, say, handle the system having a clone of assets in a folder (it could be www.domain.co.uk/s/ or subdomain or something - to keep your asset tree clean) I would make this a simple trigger.

When you add a page asset, this would fine a 'create link' trigger which creates a clone in this specific folder. This would automatically add the URL without any interruption and you would not have a huge system or remaps which are pretty difficult IMHO to administrate.

Would that work for you?

Hi Duncan,


Links rather than redirects - that could work!



I dont think the first solution would work, as the urls that we want don't actually exist yet, so I can't remap them using the remap manager. So i have www.domain.co.uk/section/sub-section/page, but I don't have the url I want www.domain/co.uk/page



But if I link all the pages I want to have short urls in a folder at the site root, then that will give them the short url webpath that I want.

So, I just need to take sections of the link and link them to the root. That's pretty easy!

And I think I can set-up a trigger to create new links if I need to as well.



Great advice - thank you http://forums.squizsuite.net/public/style_emoticons/default/smile.gif



Charlie.

No problem. Glad to be of help - remember to hide this folder in your Robots file! You don't want any duplication penalty!


Have fun.

Oh dear, just ran into 2 problems with using Linked pages in a root level folder.


1 - in order for the page to have a webpath in the folder, it seems the folder needs a url. This means the full url is no longer at the root level, it's like this: www.domain.co.uk/shorturlfolder/pagename whereas I need it to be www.domain.co.uk/pagename



2 - Viewing the page in its new short url location changes the navigation menus, as the page is no longer in the right place with its parent / child / sibling pages etc.



So, looks like I need to go back to looking at redirect assets instead, so the short url will take users to the page in its proper full url locaiton, with the menus all working as they should.



Back to the drawing board!



Charlie.