Forum

Thread tagged as: Problem, Configuration

"Mod rewriter" page

We are using Perch to quickly bootstrap and improve an old custom CMS. It uses PHP and mod-rewrite. I inserted

<?php perch_content(($_SERVER['REQUEST_URI'] == '/') ? 'Homepage carousel' : 'Header image'); ?>

Into header include file with the idea that it will pick up each page and will show "Homepage carousel" for homepage and "Header image" for any other page (per page). What it did instead was it worked fine for homepage, but then there is page called "Mod rewriter" that represents other pages.

How do I fix this please?

Simon Jones

Simon Jones 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

"Mod rewriter" isn't coming from Perch. Have you checked the value $_SERVER['REQUEST_URI'] is returning?

Oh, sorry - it actually picks up a file that it's rewritten to (mod_rewriter.php). But the question still stands. Is it possible to make it create a page per-url instead of per-file?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure - you should set the page in your front controller:

https://docs.grabaperch.com/docs/developers/working-with-front-controllers/

That's great. Thank you.

It might be worth adding a link to the Front controller article from somewhere in the docs. It's kind of hidden in the dev tips.

Let me tell you that your customer support is awesome!