Internet

WordPress Redirect Without www or www

Users can access the pages they visit using 2 different addresses. Like www.babul.net or babul.net. This situation is harmful for SEO as it will be perceived as 2 different sites for search engines.

That’s why we need to redirect the other one to whichever one we want to use on our site. For this we must edit the .htaccess file by entering the ftp directory. You must add the appropriate one to the top row from the following codes.

If you want to use the address with www, add the code below. Enter your own site address on the site address.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.babul\.net
RewriteRule (.*) http://www.babul.net/$1 [R=301,L]

Add the code below if you want to use it without www. Enter your own site address on the site address.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.babul\.net$
RewriteRule ^(.*)$ http://babul.net/$1 [L,R=301]

Redirect all links from HTTP to HTTPS

You can automatically translate requests to your website with http to https using the following code.

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Benzer Yazılar

Leave a Comment