nghi Posted September 16, 2013 Share Posted September 16, 2013 How would I go about customizing urls? I'm trying remove the portal parent from my url E.G /portal/catering/decorator /portal/catering /portal/restaurants/north /portal/restaurants/south to /catering/decorator /catering /restaurants/north /restaurants/south Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 16, 2013 Share Posted September 16, 2013 Can you tell more, I don't understand what you're after. Link to comment Share on other sites More sharing options...
nghi Posted September 16, 2013 Author Share Posted September 16, 2013 I have a category page call portal and I have child pages within that category. I would like to be able to access my child pages like this http://mywebsite.com/catering instead of this http://mywebsite.com/portal/catering but still keep my child pages within the portal category. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 16, 2013 Share Posted September 16, 2013 If you enable URL segments on the home page you could get what you want. Or you could create the rootParent catering and do your search there. 2 Link to comment Share on other sites More sharing options...
kongondo Posted September 16, 2013 Share Posted September 16, 2013 As mentioned, you can achieve this via re-categorisation of your pages or via URL segments. A similar question was asked last week. See the thread linked below and especially Ryan's response for an alternative method using hooks. http://processwire.com/talk/topic/1973-url-shortener/?p=44211 5 Link to comment Share on other sites More sharing options...
BUCKHORN Posted September 20, 2013 Share Posted September 20, 2013 I have a category page call portal and I have child pages within that category. I would like to be able to access my child pages like this http://mywebsite.com/catering instead of this http://mywebsite.com/portal/catering but still keep my child pages within the portal category. You can also add this to your .htaccess file. RewriteEngine On RewriteBase / RewriteRule ^portal/(.*)$ $1 [R,NC,NS,L] Basically it's just removing portal /portal/anything/anything to /anything/anything e.g. /portal/catering/decorator -> /catering/decorator /portal/weddings/rentals -> /weddings/rentals Link to comment Share on other sites More sharing options...
horst Posted September 20, 2013 Share Posted September 20, 2013 I think this is not a good solution, ... Basically it's just removing portal /portal/anything/anything to /anything/anything e.g. /portal/catering/decorator -> /catering/decorator /portal/weddings/rentals -> /weddings/rentals ... because what's about if someone has a page tree like this: /portal/ /something1/ /something2/ /something3/ Than he turns on your rewriting and after that, the authors someday create pages under /portal/ like this: /portal/anything1/ /portal/anything2/ /portal/something1/ Link to comment Share on other sites More sharing options...
BUCKHORN Posted September 21, 2013 Share Posted September 21, 2013 That's a good point. You'd have to account for that in your programming or tell the user to rename the page if that happens. Larger organizations sometimes use content guidelines to prevent these types of problems. I think if your pushing out that much content, enough that there's a risk of this problem happening frequently, I'm not sure I'd use mod rewrite. It may be slower than PW url segments. I'd test, but I'd expect PW to use less resources and be faster. On the other hand, making the redirect prior to loading PW, may have the advantage. Does PW require a unique page name? If so this would not be an issue, because portal would be the page parent and anything1 would be the page name. If anything1 already exists PW would not allow you to save a new page with the same name. PW may only require unique urls at each level in the tree. For example you can have a page named contact under the site root and a different page named contact under the about page. PW may see those as unique which would create the issue you mentioned. /index/contact /index/about/contact There may be other arguments against using mod-rewrite, but it's by far the simplest and quickest approach that less experienced coders can use. I'm glad you pointed out that issue, it hadn't crossed my mind and it's important to consider if you are going to use mod-rewrite. Thanks. Link to comment Share on other sites More sharing options...
diogo Posted September 22, 2013 Share Posted September 22, 2013 Does PW require a unique page name? Only under the same parent. Link to comment Share on other sites More sharing options...
BUCKHORN Posted September 22, 2013 Share Posted September 22, 2013 Thanks diogo. Yes, this would be an issue to consider as horst points out there could be collisions. Thank you both for the input. 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