<p>There are docs for removing <code>index.php</code> from your URLs here: <a href="https://craftcms.com/support/remove-index.php" rel="nofollow">https://craftcms.com/support/remove-index.php</a></p>

<p>There are also docs for enforcing SSL for all CP requests here: <a href="https://craftcms.com/support/force-ssl" rel="nofollow">https://craftcms.com/support/force-ssl</a></p>

<p>Note that they mention the the SSL rewrite should happen <em>before</em> the <code>index.php</code> rewrite in your <code>.htaccess</code> file.</p>

CC BY-SA 3.0
2016-05-03T16:54:06.743Z
2016-05-03T16:54:06.743Z
Brad Bell
<p>Using MediaTemple, I have this working:</p>

<pre><code>#FORCE HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine On

    # Send would-be 404 requests to Craft
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]

    # REMOVE INDEX.PHP
    RewriteRule (.+) index.php?p=$1 [QSA,L]

&lt;/IfModule&gt;
</code></pre>

CC BY-SA 3.0
2017-07-24T16:22:28.687Z
2017-07-24T16:22:28.687Z
SteveO
<p>I have a redirect setup for <em>www</em>, it successfully redirects to <em>https://</em> but it includes <strong>/index.php?p=</strong> in the URL. I'm not convinced by htaccess file is configured correctly.</p>

<p>Here's my htaccess file:</p>

<pre><code>RewriteEngine On

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

RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</code></pre>

<p>Help much appreciated.</p>

CC BY-SA 3.0
2016-05-03T15:33:51.780Z
There are some docs on the Craft site for removing `index.php` from your URL's. If you haven't already, take a look: https://craftcms.com/support/remove-index.php
Jamie Wade
<htaccess><https>
When redirecting to HTTPS from www, index.php appears in URL
# When redirecting to HTTPS from www, index.php appears in URL

(Asked by: username_0 on 2016-05-03)

I have a redirect setup for www, it successfully redirects to https:// but it includes /index.php?p= in the URL. I'm not convinced by htaccess file is configured correctly.
Here's my htaccess file:
RewriteEngine On

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

RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

Help much appreciated.

**Tags:** htaccess, https

> **Comments:**
> **username_1**: There are some docs on the Craft site for removing `index.php` from your URL's. If you haven't already, take a look: https://craftcms.com/support/remove-index.php  

---

## 2 answers

### Answer by username_2 on 2016-05-03. Score: 3 | Accepted answer

There are docs for removing `index.php` from your URLs here: <https://craftcms.com/support/remove-index.php>

There are also docs for enforcing SSL for all CP requests here: <https://craftcms.com/support/force-ssl>

Note that they mention the the SSL rewrite should happen *before* the `index.php` rewrite in your `.htaccess` file.


---

### Answer by username_3 on 2017-07-24. Score: 1

Using MediaTemple, I have this working:
#FORCE HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


    RewriteEngine On

    # Send would-be 404 requests to Craft
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]

    # REMOVE INDEX.PHP
    RewriteRule (.+) index.php?p=$1 [QSA,L]


---

