-
☆ A M B ☆
- 476 Posts
I'm attempting to direct a child Resource to it's parent. Using MODx Revo 2.1.3-pl.
I initially tried making the child Resource a modsymlink and then a modweblink and put
in the weblink input field in order to redirect to the direct parent. But the link in Wayfinder was directing to the ultimate parent (which was a few levels up) and not the direct parent. I've just stuck some redirect JS in the head for now, but was wondering if there was a cleaner way to do this in MODx?
Precision Web Development ... SmashStack.com
A snippet with this should do it (if I'm understanding what you want).
$modx->sendRedirect($modx->makeUrl($modx->resource->get('parent')));
-
☆ A M B ☆
- 476 Posts
Hey Bob,
That did the trick...thanks so much!
By the way, can't wait to get your book in the mail...checking the mail box everyday!
Precision Web Development ... SmashStack.com
Quote from: flinx777 at Sep 07, 2011, 12:01 AM
By the way, can't wait to get your book in the mail...
Me too.
Would this be considered a 301 redirect? If not, how would you add that?
It defaults to a 302. You can send a 301 like this:
$modx->sendRedirect('http://modx.com',array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
If it's really a permanent redirect, though, you might consider using a rewrite rule in .htaccess.