OllieMackJames Posted March 18, 2014 Share Posted March 18, 2014 I have a current site in modx evolution with many many indexed pages, all directly under the root and with an .html extension. I would like to still port this site to processwire, but because I have many first page results in the search engines, due to the structure and probably backlinks as well, it is imperative to keep all pages directly under the root with the html extension. I already found out about the setting to take out the trailing slash and that I can just name the page with .html at the end, but what I do not understand yet, is how to go about the part to remove parts of the url, I found the code from here: http://processwire.com/talk/topic/5448-remove-parents-from-url/?hl=rewriting#entry52656 /** * This hook modifies the default behavior of the Page::path function (and thereby Page::url) * * The primary purpose is to redefine blog posts to be accessed at a URL off the root level * rather than under /posts/ (where they actually live). * */ wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->template == 'post') { // ensure that pages with template 'post' live off the root rather than '/posts/' $event->replace = true; $event->return = "/$page->name/"; } }); But can not get this to work, where should I put this? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now