mod_rewrite to force www in a url?
-
I’m digging for answers, and I figured I’d try here – I need to make sure that anyone who pops in https://domain.com gets https://www.domain.com
I attempted the following in my mod rewrite:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^\kamalaspa\.com$
RewriteRule (.*) https://www.kamalaspa.com/$1 [R=Permanent]
This does the trick, but it doesn’t replace the url with a www version, it only forwards to the index www. If someone types in https://kamalaspa.com/ayurveda/ they get sent to https://www.kamalaspa.com/index.php instead of https://www.kamalaspa.com/ayurveda/
Any ideas of something I’m missing in my htaccess? Thanks all!
- The topic ‘mod_rewrite to force www in a url?’ is closed to new replies.