Best practice for redirecting pages


#1

Matrix Version: v5.4.5.1

I have some pages which are used to create a folder structure for other pages. They don’t have anything on them and I would like to make it so if anyone tries to go to those pages directly, they are redirected to the homepage, while the proper pages which are children of them are unchanged.

They are currently Standard Pages.

What is the recommended method for redirecting those pages?

  • I have tried just adding a javascript redirect, but that doesn’t happen until the page is already loaded.
  • I have considered adding a redirect page and moving all the children over to that, but it seems kind of risky and disruptive when I don’t know if it will work.
  • I looked at remapping, but it looks like you can only map to not away from. Can I remap on my target page instead?

I’m hoping there is somewhere I can do an equivalent of a mod_rewrite. I feel like there must be a simple answer to this one and I’m just not seeing it.

Thanks!


(Eric) #2

Why not use folders? Folders don’t have content and you can remove web path for a folder. You can also use paint layout on the folder to show or redirect content anywhere you want.


#3

That sounds like a good plan. Thanks!

Not sure why the pages were originally set up with nested pages, but if there was a reason it doesn’t seem relevant now.


(Bart Banda) #4

Just note that if you do this, it will remove the webpaths for any exclusively linked child assets as well. If those child assets are also linked somewhere else that has a webpath, then those will remain.

Any asset type can have its webpath removed, not just folders.


(John gill) #5

Just another superfluous 2 cents, I generally don’t use Folder assets anymore. The only unique feature they bring to the table is that you can link anything under them, which doesn’t really come up very often.

If you want to redirect users away from the “folder” then you can just use Redirect Pages. Alternatively if you think that there is a chance that down the road you will want to use the “folder” as a page (like to display a landing page, or a listing of the contents) then you should use a Standard Page now even if you don’t need it yet.

Many times I have hit situations where I thought “Ah damn, I wish I had used a Page instead of a Folder”. Not once have I ever thought “I wish I had used a Folder”.


#6

How do you handle ‘just in case’ standard pages that currently do nothing?

I’m thinking now the best thing to do is to give the standard pages I currently have a new paint layout that has nothing in it but a meta redirect. I figure that will redirect quickly and not show anything ugly if there is any delay in redirecting.

Though I’m thinking of adding a redirect metadata field to all pages so I can do temporary redirects on any page, if I need to.


(John gill) #7

Yeah, a redirect metadata field that your standard Paint Layout knows about and will turn into a JS or refresh is probably the most useful way.

Otherwise a paint layout to redirect up one level is simple and doesn’t require any new MD fields.

It would be great for Standard Page to be able to natively redirect (basically add Redirect Page functionality into Standard Page). This would be exceptionally handy when retiring pages, and would cut down on the manual labour of “swapping out” one asset for another.


#8

Agree. I had assumed it would already be a thing until I started trying to do it. I think I would want an interface that showed me all the redirects in one place too though.


#9

Could use metadata field as above but use Show If design area to check metadata field, write meta refresh and Exit design area to dump out asap?


(John gill) #10

Thanks, I really like that idea even though I keep my Design assets as small and simple as possible.

The main drawback with the Paint Layout approach is making sure it’s in every PL (or every pertinent Paint Layout). If (like me) you usually have many more PLs than Designs, the Show If is probably better :+1:


(Bart Banda) #11

Thanks guys, some really good insight here as to what the problem is and how we might address it as a new feature or enhancement. I like the idea of just being able to remove the webpath completely on an asset and still have it be part of the asset tree structure, but there are some big technical implications to that. As a minimum, some sort of built in redirect option for all asset types sounds like a good approach as well.


(Eric) #12

Very interesting discussion, and redirect strategies. We approach it from a different way. When you create folder assets it is generally for organisational purposes only and if you ever need to put content at folder level we use paint layouts with nested content.
I found benefits of folder, specially in asset listing is that it is a different asset type and so you can single it out in a tree / structure and type format/grouping etc.


(Tbaatar) #13

The way I approach with blank standard page as category/folder is to set the link type to 2 to remove it from breadcrumb and set meta tag noindex to print via metadata to stop it being crawled for search and set Up For Review to stop it being listed on any site asset lising e.g sitemap.

Since the user can’t get to this parent page there is no reason to set redirects. If in the event the user were to edit the URL (hardly anyone does this) you could set dynamic asset listing to just print whatever is underneath the page/folder.

Or if you must move the user away from this category page, you can set Archived status or set a redirect.


#14

See, editing the URL is something I do, and the page I saw was hideous, which is why I wanted the redirect.

Are you sure that hardly anyone does it?


#15

I’ve gone with adding a redirect field to the global metadata, and doing the show if thing. I’d forgotten that metadata is literal metadata that is actually added to the page.

I made sure it was included in the blank design we use and applied that design to any pages which exist just for the URL. So those now get redirected where I want them, and if I need to redirect any other page, I can, though it’s not as neat when the page isn’t blank.

Thanks everyone for the feedback, it really helped.