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.

Basic htaccess issue

May 21, 2011 10:31am

Subscribe [3]
  • #1 / May 21, 2011 10:31am

    aidan1234

    19 posts

    Hi Guys,

    Just trying to remove index.php from the sites URLs but running into issues. Haven’t work with .htaccess files before so a little unsure.

    Have created the following .htaccess file and placed it in the root

    RewriteEngine On
    RewriteCond $1 ^(group-name|P[0-9]{2,8}) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]

    I changed General config > Perferences > Name of your site’s index page to blank.

    When I try to access http://www.nameofsite/group-name/, I get a 404 error. When I try http://www.nameofsite/index.php/group-name/, it works fine.

    I also tried

    RewriteRule ^(.*)$ /index.php?/$1 [L]

    but no luck either.

    Any help really appreciated, assume I am missing something simple here.

    Tks

    [Mod Edit: Moved to the Community Help forum]

  • #2 / May 22, 2011 8:03am

    Greg Salt

    3988 posts

    Hi aidan1234,

    I’m afraid that removing index.php with .htaccess isn’t something that we can officially support so I’ve moved this thread to the Community Help forum. However, try this instead:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]

    What this says is “if the request is not for a directory or a file then send the request to the front controller index.php file”. You may have to add a question mark right after index.php (as in your rewrite rule above) depending upon your server configuration.

    Cheers

    Greg

  • #3 / Jun 03, 2011 1:57pm

    bhensonweb

    8 posts

    Thanks Greg. This fixes a problem I had with the htaccess code I was using. The problem was that the GET URLS used by EE such as ‘mysite/?ACT=69’ were breaking.

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

ExpressionEngine News!

#eecms, #events, #releases