Kompx.com or Compmiscellanea.com

HTTPS to HTTP redirect for a single page

Web servers : Apache + nginx

Redirecting a single page with HTTPS to the page with HTTP. Server configuration: Apache + nginx. SSL is enabled for the whole web site, so all pages are served with HTTPS. But there is a need to make just one single page to be with HTTP. Directives for .htaccess file:

RewriteEngine On

RewriteCond %{HTTP:HTTPS} on [NV]

RewriteRule ^(page\.html)$ http://%{HTTP_HOST}/$1 [R=301,L,QSA]

HTTPS to HTTP redirect for a single page in detail

-- Enable runtime rewriting engine

RewriteEngine On

-- If HTTPS is present

RewriteCond %{HTTP:HTTPS} on [NV]

-- Then, when a page name and extension correspond to the search group in parentheses, form for it a URI with HTTP

RewriteRule ^(page\.html)$ http://%{HTTP_HOST}/$1 [R=301,L,QSA]

Notes

  • RewriteCond %{HTTP:HTTPS} on [NV] is not the only way to detect if HTTPS is 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 on. So it should probably be checked by practice what is going to work in a particular case.
  • QSA is used to keep the existing query string, if there is any, when the replacement URI also contains a query string. So that in the end both query strings are to be combined. More on the subject: http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_qsa

Aliosque subditos et thema

 

CSS vertical alignment

 

CSS vertical alignment of a block element containing text and images. It works for various combinations of inline and block elements. Example: CSS vertical alignment CSS vertical alignment HTML / XHTML. Code: <div class="parent"> <div class="child"> <div class="childcontent">CSS vertical alignment</div> <div class="childcontent"><img src="image.jpg" width="68" height="68" alt="Image" /></div> <div class="childcontent">CSS vertical alignment</div> </div> </div> CSS. Code: .parent {position: relative; left: 0px; top: 0px; height: 200px; display: table;} .child {position: relative; left: 0px; top: 0px; display: table-cell; vertical-align: middle;} .childcontent {position: relative; left: 0px; top: 0px;} Note: .parent and .childcontent may be floated left ("float: left;") or not, but .child must be without "float: left;" for this method of CSS vertical alignment to work. [ 1 ] As well as Netscape 6.01+, Mozilla 0.6+. [ 2 ] As well as Netscape 6.01+, Mozilla 0.6+.

Lynx browser. Creating sitemap.xml

 

There are more than few online services for sitemap.xml generation. But it is also possible to do it yourself, by means of lynx web browser and several Linux command line utilities. An example bash script employing them, named "sitemap.sh" is described below. Bash script creating a sitemap.xml file: #!/bin/bash cd /home/me/sitemap/www/ lynx -crawl -traversal -accept_all_cookies -connect_timeout=30 http://www.compmiscellanea.com/ > /dev/null cd /home/me/sitemap/www2/ lynx -crawl -traversal -accept_all_cookies -connect_timeout=30 http://compmiscellanea.com/ > /dev/null cat /home/me/sitemap/www2/traverse.dat >> /home/me/sitemap/www/traverse.dat cat /home/me/sitemap/www/traverse.dat | sed -e 's/\<www\>\.//g' | sort | uniq > /home/me/sitemap/sitemap/sitemap.xml sed -i 's/\&/\&amp\;/g' /home/me/sitemap/sitemap/sitemap.xml sed -i "s/'/\&apos\;/g" /home/me/sitemap/sitemap/sitemap.xml sed -i 's/"/\&quot\;/g' /home/me/sitemap/sitemap/sitemap.xml sed -i 's/>/\&gt\;/g' /home/me/sitemap/sitemap/sitemap.xml sed -i 's/</\&lt\;/g' /home/me/sitemap/sitemap/sitemap.xml sed -i 's/http:\/\//http:\/\/www\./g' /home/me/sitemap/sitemap/sitemap.xml sed -i -e 's/^/<url><loc>/' /home/me/sitemap/sitemap/sitemap.xml sed -i -e 's/$/<\/loc><\/url>/' /home/me/sitemap/sitemap/sitemap.xml sed -i -e '1 i <?xml version="1\.0" encoding="UTF-8"?>\r\r<urlset xmlns="http:\/\/www\.sitemaps\.org\/schemas\/sitemap\/0\.9" xmlns:xsi="http:\/\/www\.w3\.org\/2001\/XMLSchema-instance" xsi:schemaLocation="http:\/\/www\.sitemaps\.org\/schemas\/sitemap\/0\.9 http:\/\/www\.sitemaps\.org\/schemas\/sitemap\/0\.9\/sitemap\.xsd">\r\r<!-- created by sitemap.sh from http:\/\/www.compmiscellanea.com\/en\/lynx-browser-creating-sitemap.xml\.htm -->\r\r' /home/me/sitemap/sitemap/sitemap.xml sed -i -e '$ a \\r</urlset>' /home/me/sitemap/sitemap/sitemap.xml sed -i '/static/d' /home/me/sitemap/sitemap/sitemap.xml echo "...Done" After the bash script file is prepared: "chmod +x sitemap.sh" to make it executable. Download sitemap.sh in sitemap.sh.tar.gz archive ( After downloading and unpacking it, put a web site name with "www" instead of http://www.compmiscellanea.com/ and a web site name without "www" instead of http://compmiscellanea.com/ in the file. Replace "static" in the last line of the file by a string unnecessary links should possess to be removed. Then "chmod +x sitemap.sh". Then run sitemap.sh ). Commentary Download sitemap2.sh with line by line commentary in sitemap2.sh.tar.gz archive. Before running the bash script, three folders should be created. Since lynx browser may miss some links if a web site domain name to be crawled is put with or without "www", bash script runs lynx twice, crawling the web site by its name with "www" and crawling the web site by its name without "www". The two result files are put into two of these separate folders, here they are "/home/me/sitemap/www/" and "/home/me/sitemap/www2/". And "/home/me/sitemap/sitemap/" is for sitemap.xml created in the end. 1. Path to bash: #!/bin/bash 2. Going to a folder - lynx browser is going to put there the files obtained from crawling a web site with "www" in its name: cd /home/me/sitemap/www/ 3. Running lynx browser to crawl a web site.