ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Removing Directory from URL with .htaccess

July 11, 2013 10:48am

Subscribe [2]
  • #1 / Jul 11, 2013 10:48am

    cozmir

    30 posts

    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 / Jul 11, 2013 12:44pm

    wildrock

    262 posts

    I do this with Structure.

    http://devot-ee.com/add-ons/structure

  • #3 / Jul 11, 2013 2:16pm

    cozmir

    30 posts

    Not using structure on this site. Thanks though.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases