1

I know this question has come up many times before, although after reading and trying dozens of answers, I am none the wiser. I am currently rebuilding my website with Ubuntu 16.04, PHP7 and apache. And what worked flawlessly on my old site (Ubuntu 14) is now not, and I cannot hide the index.php within the URL without the site crashing. This of course breaks any links to finish the craft completion and therefore is not operational. Here is my .htaccess file:

   <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Send would-be 404 requests to Craft
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [$
    RewriteRule (.+) index.php?p=$1 [QSA,L]
    </IfModule>

I have entered garbage within the .htaccess and am not receiving any change, therefore I presume it is an issue with this. The .hta is within my web route of /var/www/public_html, which is indexed correctly withing the apache config.

I've edited apache config to allow overriding:

<Directory />
  Options FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>

I've also made sure that omitting script names is enabled:

'*' => array( // production by default
    'siteName' => '*****',
    'omitScriptNameInUrls' => true,
    'siteUrl' => 'http://' . $_SERVER['SERVER_NAME'] . '/',
    'timezone' => 'Europe/London',
    'allowAutoUpdates' => true,
    'cpTrigger' => 'mgmt',
    'rememberUsernameDuration' => false,
)

Sigh If anybody could suggest anything else, it would be very much appreciated!

  • Do you know for sure that it's Apache that's serving the site? Not, for example, nginx? – Steve Abraham Dec 11 '16 at 11:55
  • Thanks for the reply Steve, I have run a curl request and the response shows: HTTP/1.1 503 Service Unavailable Date: Wed, 14 Dec 2016 15:07:07 GMT Server: Apache/2.4.18 (Ubuntu) Set-Cookie: CraftSessionId=3p798shkk9suliaq0kgsm2ln87; path=/; HttpOnly Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache X-Powered-By: Craft CMS charset: utf-8 Connection: close Content-Type: text/html; charset=utf-8 – James Saunders Dec 14 '16 at 15:10
2

I have found the solution within the answered question: omitScriptNameInUrls is not working

'sudo a2enmod rewrite' was needed!

Thanks all.

| 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.