Posts Tagged ‘Apache’

How-To Remove The Password From a SSL Certificate Key File

Tuesday, September 11th, 2012

In case you find yourself with a SSL Certificate for your your domain and need to use it in systems where automatic processed will restart the web server (i.e. Apache 2), I guess you have discovered that a serious problem arise: the web server will not restart properly until you provide the password for the certificate.

As far as you consider secure the system from theft of the certificate, a workaround to this problem is to generate a copy of the SSL Certificate Key stripped of the password, you can achieve that executing this following command:

~$ sudo openssl rsa -in my_domain_certificate_with_password.com.key -out my_domain_certificate_without_password.com.key

At this point you just need to update the virtualhost configuration on your webserver to use the new key file (or remove the key file protected by password overwriting it with the key file NOT protected by password).

This information has been sourced from:
http://chrisschuld.com/2008/08/removing-the-password-on-an-apache-ssl-certificate/

Any comment and advise is welcome as always

How-To Redirect PATHINFO (Almost Pretty) Permalinks To Pretty Permalinks

Wednesday, March 21st, 2012

This post is about supporting your former PATHINFO Permalinks structure (a.k.a. Almost-Pretty-Permalinks), on your new web-site using Pretty-Permalinks.

 Redirect 301 /index.php/ http://www.yoursite.com/
 RewriteRule . /index.php [L]

These are the lines of Apache’s configuration that must be present in the website’s main .htaccess file:

 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 Redirect 301 /index.php/ http://www.yoursite.com/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>

This case applies to those websites formerly configured to use PATHINFO Permalinks and for which all the old posts and pages have been indexed by the Web Search Engines (Google, Yahoo, Bing, etc) using the former structure that included the HORRIBLE! “/index.php” string in their URIs, i.e.:

https://www.marcomc.com/index.php/tech/

When these sites finally migrate to the Pretty-Permaling structure, the one that does NOT include the  horrifying “/index.php” piece, i.e.:

https://www.marcomc.com/tech/

it happens that all the search engines’ indexes will result suddently outdated, and that will penalise the sites at least in two ways:

  1. It will cause a loss of accesses because the back-links to the sites that are present on other blogs or in people’s favourites and bookmarks, or in the search engines’ indexes will be ‘broken’ (old) and the people will be unable to access the pages or posts unless browsing from the homepage.
  2. It will cause a loss of ranking in the search engines’ databases (S.E.O. perspective) because the sites will result ‘broken (unaccessible) and in some cases may even result like sites with duplicated content because the search engines’ spiders will index the pages as NEW pages (due to their new URIs) and the content will match the caches indexed with the old URIs (at least until the caches expire).

To prevent such mayhem you need to put in place a 301 (permanent) redirection that will tell the search engines that all the requests to URIs containing the ‘/index.php’ bit have to redirected to similar URIs not containing it, i.e.:

Redirect 301 /index.php/ https://www.marcomc.com/

This string gives instructions to the web server about what to communicate to the Search Engines when a PATHINFO request is received.

Most importantly the 301 redirection will instruct the search engines that the URIs containing “/index.php” have to be considered deprecated and that from now on, the site will not use it anymore. This is fundamental to avoid the search engines to consider the content of the site as a duplicated content.

Secondly you will need to put in place also a generic rewrite instruction that will tell the local web server (Apache) to accept all the incoming requests to URIs with a PATHINFO format and return the content of the new and purged URIs:

RewriteRule . /index.php [L]

This string gives instructions to the web server on what it must to do when a PATHINFO request is received.

I did use these redirection settings for my WordPress blog when I did migrate to a full L.A.M.P. server (GNU/Linux, Apache, MySQL, PHP) from the former Windows Server hosting service running Microsoft IIS and that did not support ‘.htaccess’ files but exclusively PATHINFO directives and for which I did not have access to the server’s core configurations, therefore I was forced to use “/index.php” in my permalinks.

If you did like this post leave a comment in sign of appreciation, ad if you are Facebook please consider to ‘Like’ MarcoMC.com page. Check the FB banner on the right widgets column of this page …     ========================================>>

I did take inspiration for this post at following this thread:

http://www.wptavern.com/forum/troubleshooting/489-mod_rewrite-make-pretty-permalinks-prettier.html