Hello to all masters here.

I'm totally new in configuring website and also I'm not an developer, so please be kind to me :-)

I have my own website growduino.cz and want all traffic redirect (301 for good google seo ranking) to https and www.. This must be done in one request, because of short time of redirect itself. But also if user puts www. or https in the browser, the site must work flawlessly.

I have tried many guides from teh internets, but with no luck. Site is Apache and WordPress.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

Acual result is: If user put http or https and sitename growduino.cz, it works. But if user puts also "www." , it will of course not work.

I'll be glad if you can help, thank You.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.