To redirect the URL addresses of your domain from HTTP to HTTPS, add the following code at beginning in the
.htaccess
file.
- It is a 301 redirect, good for SEO.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Make URL address without www
If you also want to make all the URL addresses of your website without www, add the following code in .htaccess.
- Replace "
domain_name" with the name of your domain.
RewriteCond %{HTTP_HOST} ^www.domain_name.net
RewriteRule ^(.*)$ https\:\/\/domain_name.net\/$1 [R=301,L]
- Make sure that the links in the pages of your website are with the New Address.
Daily Test with Code Example
HTML
CSS
JavaScript
PHP-MySQL
What attribute makes an option from <select> selected?
checked="checked" selected="selected" disabled="disabled"<select name="a_name">
<option value="val1">Option 1</option>
<option value="val2" selected="selected">Option 2</option>
</select>
What CSS value allows to create color gradients for background?
contain repeat-x linear-gradient#id {
background: linear-gradient(top left, #1f1, #fff, #11f);
}
What statement creates an array in JavaScript?
[] {} new Object()var arr = [1, "CoursesWeb.net", "MarPlo.net"];
alert(arr[2]);
Indicate the PHP function used to redirect to other page.
function() header() switch()header("Location: http://coursesweb.net/");
exit;