I currently have a website that is redirecting from -
#-- Redirect http://www.mywebsite.com/en/index.php ---> http://www.mywebsite.com/
#Redirects
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/en/index.php$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]
I need to add another condition for it to redirect from mywebsite.com ---> http://www.mywebsite.com/
Basically i need to add a statement to redirect non www users to force them into wwww.
How can i do this without both conditions and rules messing each other up?
Any help is appreciated
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
RewriteRule ^(.*)$ http://www.mywebsite.com$1 [L]
RewriteCond %{REQUEST_URI} ^/en/index.php$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]
It is possible not to mention mywebsite.com at all, just to check the starting www and use backreference for the domain (did not check the rule).
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.(.*)$
RewriteRule ^(.*)$ http://www.%1$1 [L]
RewriteCond %{REQUEST_URI} ^/en/index.php$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.