<p>Check out: <a href="https://craftcms.com/support/remove-index.php" rel="nofollow noreferrer">Removing “index.php” from URLs</a></p>

CC BY-SA 3.0
2017-11-20T20:44:01.123Z
Perfect. 'omitScriptNameInUrls' was commented out in my multi environment config. Thanks Andrew!
Shift2Design
CC BY-SA 3.0
2017-11-20T20:17:59.557Z
2017-11-20T20:17:59.557Z
andrew.welch
<p>I have a Craft site where I need to redirect any traffic to www (including dev.lakesideohio.com). The rule seems to be working but for some reason the url gets changed to using index.php with query string which I am not using.</p>

<p>For example <a href="https://mysite.com/news" rel="nofollow noreferrer">https://mysite.com/news</a> goes to <a href="https://www.mysite.com/index.php?p=news/" rel="nofollow noreferrer">https://www.mysite.com/index.php?p=news/</a> instead of <a href="https://www.mysite.com/news" rel="nofollow noreferrer">https://www.mysite.com/news</a>.</p>

<pre><code>&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On

# Redirect to www
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L] 

# 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]     
</code></pre>

<p></p>

<htaccess>
Simple Craft htaccess Help
# Simple Craft htaccess Help

(Asked by: username_0 on 2017-11-20)

I have a Craft site where I need to redirect any traffic to www (including dev.lakesideohio.com). The rule seems to be working but for some reason the url gets changed to using index.php with query string which I am not using.
For example https://mysite.com/news goes to https://www.mysite.com/index.php?p=news/ instead of https://www.mysite.com/news.

RewriteEngine On

# Redirect to www
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L] 

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

**Tags:** htaccess


---

## 1 answers

### Answer by username_1 on 2017-11-20. Score: 1 | Accepted answer

Check out: [Removing “index.php” from URLs](https://craftcms.com/support/remove-index.php)

> **Comments:**
> **username_0**: Perfect. 'omitScriptNameInUrls' was commented out in my multi environment config. Thanks Andrew!  

---

