0

Using MAMP Pro I have an offline/local EE site setup. An htaccess file is set up in the root of the local domain site with the standard remove index.php script implemented (as shown in the offical ExpressionEngine documentation).

I know the htaccess is being picked up because I can get a 500 server error page to execute if I put random code in in the file.

However if I put the official EE index.php removal code in the htaccess and go to local.sitename/sitepage I get the following error:

Not Found The requested URL /sitepage was not found on this server.

Just to confirm I have the following in the .htaccess:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/systemfoldername/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

In terms of MAMP set up:

  1. I have Mamp Pro installed with Set ports Apache and MySQL to 80,443 and 3306.
  2. A local custom domain set up via HOSTS panel ' ie. local.sitename '.
  3. Under HOSTS > Extended TAB > 'Options All'. is selected to include all options.
  4. PHP Version set to Default: (5.5.26) for local domain.

In terms of EE Control Panel:

  1. 'index.php' is removed from: Admin > General Configuration > Name of your site's index page (field).

In terms of htaccess variations of I have tried:

  1. Removing <IfModule mod_rewrite.c> tag pair.
  2. Adding a local path for RewriteBase / (ie. RewriteBase /username/sites/sitename/ etc).
  3. Removing the slash '/' from before index.php on line: RewriteRule ^(.*)$ /index.php/$1 [L]
  • Does it work when you do include index.php in your URLs? Go to say, localhost/index.php/site/index (with a template group named site). Also, check server and error logs. – Ingmar Dec 3 '15 at 11:24
  • Hi Ingmar, yes it all works with the re-inclusion of 'index.php'. I've also been checking the 'Apache' console logs and it does give the following error: [Thu Dec 03 11:41:37 2015] [error] [client ::1] File does not exist: /Users/username/Sites/sitename/local/sitepage, referer: local.sitename – Karl Bowers Dec 3 '15 at 11:45
  • Have you tried to "force query strings" in the Debugging & Output settings? – Ingmar Dec 3 '15 at 11:59
  • Yes I've just tried the 'force query strings' and no joy. – Karl Bowers Dec 3 '15 at 12:38
  • ** Update ** What I have discovered is that the issue is with this particular local EE installation. What I have done is migrated another live EE site down to my local Mamp setup, reconfigured for local paths /SQL etc and this works no problem with htaccess index.php removal! – Karl Bowers Dec 3 '15 at 12:40
1

This fixed it:

The actual formatting of the .htaccess file was incorrect.

It needed to be as per attached PNG snapshots:

enter image description here

enter image description here

Once I refomatted the file as shown above the issue was resolved!

| improve this answer | |

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.