1

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.

<IfModule mod_rewrite.c>
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]     

1 Answer 1

1

Check out: Removing “index.php” from URLs

1
  • Perfect. 'omitScriptNameInUrls' was commented out in my multi environment config. Thanks Andrew! Commented Nov 20, 2017 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.