Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Child pages, slugs and URLs
#7
@RobA

A quick hack to make SimpleCache plugin enforce canonical URLs. Edit simplecache.php, line 48, insert this:
Code:
if ($_SERVER['REQUEST_URI'] != find_url(return_page_slug(), get_parent(false), 'relative')) {
        redirect(find_url(return_page_slug(), get_parent(false)));
      }

(Just after the if(!in_array(return_page_slug() ... line)

You will be redirected to the correct URL (structure defined in GS settings). Pages excluded from caching will not be checked/redirected.

Why choosing SimpleCache for this experiment? Because it has more or less the same problem with url parameters as canonical redirection.

PS I might have tried to do a mini-plugin that reads SimpleCache's config and does all this, instead of patching the plugin, but there's a problem: as it would have to be hooked to 'index-pretemplate', I'm not sure if it would always (or on any system) be fired before SimpleCache (or any other plugin that uses that hook).
Reply


Messages In This Thread
Child pages, slugs and URLs - by RobA - 2011-06-17, 00:37:05
Child pages, slugs and URLs - by mvlcek - 2011-06-17, 00:50:20
Child pages, slugs and URLs - by Carlos - 2011-06-17, 01:06:19
Child pages, slugs and URLs - by RobA - 2011-06-17, 04:06:34
Child pages, slugs and URLs - by Carlos - 2011-06-17, 05:34:26
Child pages, slugs and URLs - by yojoe - 2011-06-17, 08:12:12
Child pages, slugs and URLs - by Carlos - 2011-06-27, 05:54:33



Users browsing this thread: 1 Guest(s)