1

I have a site setup with a template directory called “pages” so I can call to the pages with the following URL:

http://sitename.com/pages/page-name

However, for SEO reasons I would prefer to remove the “pages” part of the URL so that it reads as:

http://sitename.com/page-name

A search on Google has presented some possible solutions but there is some type of conflict. Perhaps with the my rules to remove “index.php”? Can anyone offer any pointers? Below is my current redirect conditions.

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
  RewriteEngine On
# BEGIN ExpressionEngine Rewrite
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
  RewriteRule ^(.*)$ /index.php?$1 [L]
# END ExpressionEngine Rewrite
</IfModule>  
2
  • I think those are mis-guided SEO reasons. Sure, do it because you think /page-name is prettier, but there's no SEO benefit to having a slightly shorter URL. Jul 23, 2013 at 14:03
  • Thanks for your 2¢ but there is a larger SEO strategy in place for this site that does require very a specific semantic URL structure. It's not about a short URL.
    – Scott
    Jul 23, 2013 at 19:00

1 Answer 1

1

Does the 'pages' group contain your homepage? If so, just turn Strict URLs off. Then you can access /pages/my-page at /my-page.

Turning off Strict URLs makes the URLs less... strict. You will have to more 404 handling yourself. You will have to put some conditionals in your pages to check for extra segments.

For example, the template blog/post might display a post with a URL of /blog/post/my-blog-post.
However, you could access the exact same page at /blog/post/my-blog-post/extra/segments/blah/blah. Google would see these as different pages. Duplicate content, bad for SEO.

To fix this, add to your template something like:

{if segment_3}{redirect="404"}{/if}
2
  • Thanks! I'll fool around with this. That directory does not contain the homepage though. Does EE default to that homepage template directory with strict URLs off? (I have a very different template for the homepage versus the sub pages.)
    – Scott
    Jul 23, 2013 at 19:03
  • Yeah this technique only works for the template group holding your homepage. Jul 24, 2013 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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