<p>I have found the solution within the answered question: 
<a href="https://craftcms.stackexchange.com/questions/9330/omitscriptnameinurls-is-not-working?rq=1">omitScriptNameInUrls is not working</a></p>

<p>'sudo a2enmod rewrite' was needed!</p>

<p>Thanks all.</p>

CC BY-SA 3.0
2016-12-15T12:01:02.033Z
2016-12-15T12:01:02.033Z
user5989
<p>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:</p>

<pre><code>   &lt;IfModule mod_rewrite.c&gt;
    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]
    &lt;/IfModule&gt;
</code></pre>

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

<p>I've edited apache config to  allow overriding:       </p>

<pre><code>&lt;Directory /&gt;
  Options FollowSymLinks
  AllowOverride All
  Require all granted
&lt;/Directory&gt;
</code></pre>

<p>I've also made sure that omitting script names is enabled:</p>

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

<p><em>Sigh</em> If anybody could suggest anything else, it would be very much appreciated!</p>

CC BY-SA 3.0
2016-12-11T11:55:39.863Z
Do you know for sure that it's Apache that's serving the site? Not, for example, nginx?
Steve Abraham
CC BY-SA 3.0
2016-12-14T15:10:44.360Z
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
<url><htaccess><apache>
Cannot omit index.php from URL
# Cannot omit index.php from URL

(Asked by: username_0 on 2016-12-09)

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:
   
    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]
    

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:       

  Options FollowSymLinks
  AllowOverride All
  Require all granted


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!

**Tags:** url, htaccess, apache

> **Comments:**
> **username_1**: Do you know for sure that it's Apache that's serving the site? Not, for example, nginx?  
> **username_0**: 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  

---

## 1 answers

### Answer by username_2 on 2016-12-15. Score: 2

I have found the solution within the answered question:
[omitScriptNameInUrls is not working](https://craftcms.stackexchange.com/questions/9330/omitscriptnameinurls-is-not-working?rq=1)

'sudo a2enmod rewrite' was needed!

Thanks all.


---

