Page Router

Navigation:  Development > System Definition > URI Manager >

Page Router

Previous pageReturn to chapter overviewNext page

Page Router used to change the URL. We can catch and rename each page URL by this router. Below is the location of Page Router definition file.

 

/development/definition/uri_manager/page_router.xml

 

Each Routing role has two part 1) Actual, 2) Virtual. Actual part contain the URL that we have to masked and Virtual part is the replaced URL like:
 
page/view/terms convert terms-and-conditions. below is the the conversion
 
<role>
  <actual>page/view/terms</actual>
  <virtual>terms-and-conditions</virtual>
</role>

 

According to the above example website URL is www.example.com/terms-and-conditions which calls below Action Method
 
public function viewAction($pagename = null){
 
}

 

"terms" in the URL will store in $pagename variable for further use. See below full example of a Page Rotuer
 
<URIManager>
  <pagerouter>
      <!-- Home controller -->
      <role>
          <actual>home/search</actual>
          <virtual>search</virtual>
      </role>
      <!-- Home controller End -->
      <!-- Page controller -->
      <role>
          <actual>page/view/terms</actual>
          <virtual>terms-and-conditions</virtual>
      </role>
      <role>
          <actual>page/view/aboutus</actual>
          <virtual>about-us</virtual>
      </role>
      <!-- Page controller End-->
  </pagerouter>
</URIManager>