0

I have a WordPress site I am working on, in which /pages/ appears in the URI for all Pages.

For example, www.site.com/pages/contact-us/

I am stumped as to why this is occurring, it doesn't occur on other sites I am working on.

Is this something a theme might be forcing to occur?

Would a redirect in .htaccess be the easiest way to remove /pages/ from all page links/URIs ? If so, what rule would do the trick?

I tried using the following <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^/pages(/.*|)$ $1 [L,NC]
</IfModule>

And

<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^pages(/.*|)$ $1 [L,NC]
</IfModule>

But neither has any effect.

The site is in a sub-folder, /wp1 with a redirect rule to remove the /wp1 from the URI. So I am thinking that this is causing my rule to remove /pages/ to not work. If that is the case, what would be the correct way to structure the rule, or to remove the /pages/ by some other WordPress based means?

6
  • What permalinks settings are you using? What about permalinks in edit page? Does it contain /pages/?
    – N00b
    May 9 '16 at 14:32
  • Permalink structure is just /%postname%/. Yes, /pages/ appears on the Edit screen. I see that this page has a parent page. Could that be what forces /pages/ into the uri?
    – omega33
    May 9 '16 at 15:58
  • Okay. So, taking it away from being a child page got ride of /pages/. So being a child is what caused the issue. Is there a way in WP to prevent that happening to child pages?
    – omega33
    May 9 '16 at 15:59
  • What's the parent page called? /pages/ should be automatically the name of parent page, for example: www.site.com/info/faq/ and www.site.com/info/rules/. Info would be parent page and faq, rules child pages. But if that's not the case for you (some misconfiguration) ,as you saw, you can easily change permalink, you need to make the page one way or the other, changing this small detail should not be a problem.
    – N00b
    May 9 '16 at 16:04
  • Well, it's good you mentioned that. I just checked, and it turns out the parent page was given the slug pages (as opposed to one based on its name, our-company. There's the source of the issue. So, is there an easy way to prevent child pages from showing the parent page in the URI, or is it going to be simply to just not have them as child pages?
    – omega33
    May 9 '16 at 16:12
3

What causes /pages/ to appear in URI?

As it turned out, you had a parent page with slug pages.

How to remove it?

Don't have a parent page.

is there an easy way to prevent child pages from showing the parent page in the URI?

This has been asked and answered countless times, for example here, you can find more here. Im not going to duplicate these answers.


Parent and child page relationship isn't just a tool for editor or developer to organize their pages in admin area. URI and page relationships design should be a part of your development process. Pages should be organized meaningfully. If child and parent relationship between two pages doesn't make sense, just remove the relationship.

Good URI should function as a breadcrumb. User should know exactly where he/she is.

While this isn't always the case, note that parent page should ideally have a logical list of all it's children.


Example:

You have 4 pages: faq, rules, terms, instructions

While you could use all of these individually, it would make a perfect sense to make a parent page info which contains a pretty list to all these pages. Now you don't have to have trillion links in your menu or a single big page which makes users flee as soon as he/she sees it. You have a single Info which contains links to logically isolated subjects - easy for eyes and easy to reason about.


In your case www.site.com/our-company/contact-us/ would make sense if you have other pages too, e.g www.site.com/our-company/about-us/ but if it was a single child, I would remove the parent.

1
  • Thanks for this. Will implement these suggestions. One thing which might not be accurate in your answers is, "Either change the permalink from edit page". In my case, the edit page doesn't allow me to change the portion of the permalink coming from the parent page. I can only change the last part, generated by the page being edited.
    – omega33
    May 9 '16 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.