Jump to content

Recommended Posts

Posted

Hi All,

I am curious. Is there a plugin/module to redirect a ¨page¨ to a existing URI in the system. Rather than duplicating the content for two pages, creating a menu selection in two different place for the same page?

Posted

Hi Jason,

if you're doing it just for a few pages, you don't need any module/plugin; you can do this simply by using templates! :)

  • Create field 'redirectTo' – customizable, of course
  • Set that field to be 'single page', and select the inputfield you wish
  • Create template 'redirectPage' – again, custom :)
  • put following code in your template file
  • Create page that links to original page
  • you've made your virtual page

Code for your template:

<?php
/*
 * Template: redirectPage
 *
 * Used to redirect URL adress to other page with 301 HTTP code
 */
$session->redirect( $page->redirectTo->url );

I actually use this at least once each site.

  • Like 6
Posted

Hi Jason,

if you're doing it just for a few pages, you don't need any module/plugin; you can do this simply by using templates! :)

  • Create field 'redirectTo' – customizable, of course
  • Set that field to be 'single page', and select the inputfield you wish
  • Create template 'redirectPage' – again, custom :)
  • put following code in your template file
  • Create page that links to original page
  • you've made your virtual page

Code for your template:

<?php
/*
 * Template: redirectPage
 *
 * Used to redirect URL adress to other page with 301 HTTP code
 */
$session->redirect( $page->redirectTo->url );

I actually use this at least once each site.

Thank you a MILLION times over, Adamkiss! That is exactly what I was trying to do! Cant wait to use it. This is my first project using processwire. I will post a link when its done!

  • 2 years later...
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...