Kompx.com or Compmiscellanea.com

HTTP to HTTPS redirect in .htaccess

Web servers : Apache + nginx

Redirecting from all domain names of a web site to its web address with HTTPS and the domain with www. The names to be redirected from are:

  • Both with and without www - URL with HTTP
  • Without www - URL with HTTPS

Server configuration: Apache + nginx. SSL is enabled. SSL-certificate is purchased, approved and installed. That is, everything is up and running. So it is just the HTTP to HTTPS redirection that is left to get ready and start up. Directives for .htaccess file:

RewriteEngine On

RewriteCond %{HTTP:HTTPS} !on [NV]

RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.

RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L]

HTTP to HTTPS redirect in detail

-- Enable runtime rewriting engine:

RewriteEngine On

-- If HTTPS is not present:

RewriteCond %{HTTP:HTTPS} !on [NV]

-- Then replace HTTP + domain (with or without www) with HTTPS + domain with www:

RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L]

-- If HTTPS is present, but domain name has no www (the case when https://domain.tld is entered in address bar):

RewriteCond %{HTTP_HOST} !^www\.

-- Then replace it with HTTPS + domain with www:

RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L]

Notes

  • RewriteCond %{HTTP:HTTPS} !on [NV] is not the only way to detect if HTTPS is not present. Moreover, for some server configurations other directives may be more suitable, like RewriteCond %{SERVER_PORT} !443 for example. The point is to find out somehow if HTTPS is not on. So it should probably be checked by practice what is going to work in a particular case.
  • Apache Module mod_rewrite docs: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Aliosque subditos et thema

 

ELinks. Use

 

Jump to: ELinks - Text-based or console web browser. Description: features, screenshots, download links. ELinks. Configuration - How to configure ELinks. Once started, ELinks allows a user to do almost all it is capable of by means of its menu. So it is only how to start ELinks and how to do several other things as an example that is explained here. 1 ) Starting ELinks - ELinks may be run under a GUI environment (X Windows, MS Windows, etc) or some command-line interface. In the first case a terminal emulator / console must be opened before ELinks is to be started: xterm, rxvt, Win32 console and others: ELinks ( Linux ) - To start ELinks, enter command: elinks - To start ELinks opening a web document from Internet: elinks Web address of a web document - To start ELinks accessing hard disk to browse local folders: elinks file:/// or: elinks / - To start ELinks opening a local folder: elinks file:///home/user1/ or: elinks /home/user1/ - To start ELinks opening a local file: elinks file:///home/user1/document1.htm or: elinks /home/user1/document1.htm ELinks ( Windows ) - To start ELinks, enter command: elinks - To start ELinks opening a web document from Internet: elinks Web address of a web document - To start ELinks accessing hard disk to browse local folders: elinks file:/// - To start ELinks opening a local folder: elinks file://c/home/user1/ - To start ELinks opening a local file: elinks file://c/home/user1/document1.htm 2 ) To access the menu of ELinks: Press Esc on keyboard 3 ) Opening a web document in ELinks already running: Press g on keyboard or Esc --> File --> Go to URL --> [ Enter a web address ] --> Enter 4 ) Going back: Left arrow of Arrow keys on keyboard or Esc --> File --> Go back 5 ) Opening a link in a new tab in background: Shift - t or Esc --> Link --> Open in new tab in background 6 ) Going to the next tab: Shift - > or Esc --> View --> Next tab 7 ) Closing a tab: Press c on keyboard or Esc --> View --> Close tab 8 ) Passing a URI to an external application when running ELinks in a terminal emulator. There are many applications it is possible to pass a URI to, here it is about passing a URI to clipboard.

Renaming files in DOS

 

Renaming files in DOS by REN command REN FILE1.TXT FILE2.TXT - Renames FILE1.TXT into FILE2.TXT REN FILE1.TXT FILE2.HTM - Renames FILE1.TXT into FILE2.HTM REN *.TXT *.HTM - Renames all files with .txt extension into files with .htm extension. Only extensions are changed, the file names proper are left as they were. Since REN is the shorter form of RENAME command, RENAME may be used instead - as more self-explaining may be. Renaming files in DOS by MOVE command MOVE FILE1.TXT FILE2.TXT - Renames FILE1.TXT into FILE2.TXT MOVE FILE1.TXT FILE2.HTM - Renames FILE1.TXT into FILE2.HTM Both methods of file renaming work in Windows command prompt as well. But there is a certain distinction: MS-DOS, other typical / older DOS'es, command prompt of Windows prior to Windows 95 and Windows NT 3.51 use a short filename / 8.3 filename convention. So, for example, REN FILE1.HTM FILE1.HTML is not going to work, there will be "Duplicate file name or file name not found" message. And that is not the case with newer DOS'es or command prompt of newer Windows. It can be not the case in older DOS'es also - if relevant drivers are installed. [ 1 ] MS-DOS 6.0+ tested - but it also may happen to work well under other versions of MS-DOS or other DOS'es.