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.

EE2: .htaccess and robots.txt examples

May 26, 2010 8:04am

Subscribe [4]
  • #1 / May 26, 2010 8:04am

    eduqate

    53 posts

    Firstly where do I place robots.txt in an EE installation? I assume in the root alongside the topmost index.php (I have both 1.6 and 2.0 to set up).

    Second, do I need to bother about .htaccess? If so are there any examples?

    Are these any EE best practices for either of these?

  • #2 / May 26, 2010 8:25am

    Ingmar

    29245 posts

    Yes, a robot.txt would go in the domain’s root, just as if there were no EE. No, you don’t have to bother about .htaccess. If you do, be sure to take a look at this Wiki entry—and do bear in mind that it’s not officially supported.

  • #3 / May 26, 2010 7:52pm

    grrramps

    2219 posts

    Second, do I need to bother about .htaccess? If so are there any examples?

    .htaccess can have many functions, so it depends on your needs. For any new site I start with basics:

    DirectoryIndex index.php index.html
    RewriteEngine On
    ReWriteBase /
    RewriteCond %{HTTP_HOST} !^mysite.com$ [NC]
    RewriteRule ^(.*)$ <a href="http://mysite.com/$1">http://mysite.com/$1</a> [R=301,L]

    That sets up a default to the index.php file first, and redirects any http://www.mysite.com to plain old mysite.com (Google doesn’t really like both, unless content is different).

    .htaccess does a lot more, though, and is needed to remove index.php from the URL string.

  • #4 / May 26, 2010 9:34pm

    Brandon Jones

    5500 posts

    Thanks, grrramps. Going ahead and shifting this thread over to How-to.

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

ExpressionEngine News!

#eecms, #events, #releases