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
Which tag can be used to create input text field in web page?
<form> <input> <div>
<input type="text" name="a_name" value="val" />
Which CSS property displays the text in a small-caps font?
display font-variant font-style
h3 {
  font-variant: small-caps;
}
What instruction displays a notice box with a message inside it, in JavaScript?
for() Date() alert()
var msg = "Visit CoursesWeb.net";
alert(msg);
Indicate the PHP code used to get the users IP.
$_SERVER["HTTP_USER_AGENT"] $_SERVER["REMOTE_ADDR"] $_GET[]
$ip = $_SERVER["REMOTE_ADDR"];
echo $ip;
htaccess - Redirect URL address from HTTP and WWW to HTTPS

Last accessed pages

  1. Display UL bullets and OL numbers on the right side (3255)
  2. Insert, Select and Update NULL value in MySQL (50171)
  3. Node.js Move and Copy Directory (7234)
  4. JavaScript code and PHP (28186)
  5. Node.js Move and Copy file (17028)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (2974)
  2. Contact page - CoursesWeb (2865)
  3. Tabs effect with CSS (2847)
  4. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (1039)
  5. PHP getElementById and getElementsByTagName (998)