saml Posted April 5, 2014 Share Posted April 5, 2014 This might sound backwards in terms of SEO optimizations, but we have a use case where we would prefer using unnatural ids (such as the page id) for certain page types. I was wondering how I would most easily implement that? Is there a module for customizing url path behavior, or some simple setting somewhere? Have googled / browsed around a bit but couldn't find it mentioned anywhere how to go about this. Link to comment Share on other sites More sharing options...
Soma Posted April 5, 2014 Share Posted April 5, 2014 Keyword would be most likely urlsegments. Link to comment Share on other sites More sharing options...
adrian Posted April 5, 2014 Share Posted April 5, 2014 Does this do what you are looking for? http://modules.processwire.com/modules/process-redirect-ids/ 1 Link to comment Share on other sites More sharing options...
saml Posted April 7, 2014 Author Share Posted April 7, 2014 Does this do what you are looking for? http://modules.processwire.com/modules/process-redirect-ids/ Many thanks! it seems this module might be able to solve the problem for us, although, we will probably want to just use the id-based urls as is, without redirecting to the full urls, but maybe that is configurable anyway? Link to comment Share on other sites More sharing options...
adrian Posted April 7, 2014 Share Posted April 7, 2014 There is an option in the module config settings for that - it's called Redirect Type: Redirect vs Load. You'll want the load option. Just an FYI - the modules automatically adds a canonical link to the full url to help search engines. 2 Link to comment Share on other sites More sharing options...
saml Posted April 7, 2014 Author Share Posted April 7, 2014 There is an option in the module config settings for that - it's called Redirect Type: Redirect vs Load. You'll want the load option. Perfect, thanks! Link to comment Share on other sites More sharing options...
Soma Posted April 7, 2014 Share Posted April 7, 2014 One way without module would be to just enbale urlSegments on home/root template. Then do create urls with domain.com/1003 Then in the template something like this: if($input->urlSegment1){ $id = (int) $input->urlSegment1; $p = $pages->get("id=$id, include=hidden"); if($p && $p->id && $p->viewable()) { echo $p->render(); } else { throw new Wire404Exception(); } } else if(count($input->urlSegments) > 1) { throw new Wire404Exception(); } 3 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