Category Archives: General

The Best Web Development Choice I Ever Made!

The Evolution of My Web Development Environment

The Early Days: Manual Setup

When I first dipped my toes into Web Development, I embraced the challenge of manually installing and configuring PHP, Apache, and MySQL on my Windows machine. It was a steep learning curve, but it worked, and I felt accomplished.

The VM Era: Convenience and Performance

As time passed, I discovered the power of virtual machines (VMs). I started with Windows Virtual PC, later adopting user-friendly solutions like XAMPP and WampServer. This setup served me well, and I eventually upgraded to VMWare for better virtualization.

The Performance Dilemma

However, the arrival of Windows 10 and VMWare 14-15 brought an unexpected challenge: a significant drop in performance. Simple tasks that once took milliseconds now lagged for 5-8 seconds. Switching to VirtualBox offered some improvement, but it never matched the speed I remembered from less powerful machines.

Frustrated, I spent countless hours attempting to tweak PHP, Apache, and MySQL settings, all to no avail. I tried creating fresh Windows 7, 10 & 11 machines, but the performance issues persisted in all cases, eating into my daily productivity and patience.
 
Continue reading

Online Collaboration Tools for SQL, HTML/CSS/JS and RegEx

More and more, I see my business moving away from Access an toward the cloud. That is simply the reality of the world we live in. People want their data accessible on any and every device and Access simply does not offer that natively.

As such, in the past few years I have been immersing myself in HTML, CSS, JS, PHP, MySQL, SQL Server and Azure, …

Sometimes, it can be very convenient to be able to demonstrate coding to fellow developers, to get help (forum postings), to collaborate, … or even just to quickly test out a concept rather than needing to setup your development environment you can use one of these tools.

Today, I thought I’d share a few online tools that enable such collaboration

Continue reading

htaccess Force https on Domain but not on SubDomain

I recently wanted to setup SSL on 2 of my websites.  So I purchased the SSL Certificates and performed the installation through my host’s domain portal.

My host modified my default .htaccess file by adding

#RewriteEngine On
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ https://DomainName.com/$1 [R=301,L]

The problem was that I had a subdomain, for personal use, on one of my domains and I did not want to force https on it since my SSL certificate was only for the main domain.  The above ReWrite rule is indiscriminant and forces https on all urls.  I contacted my host and they weren’t very helpful, so I knew I was on my own to figure this one out.

I won’t bore you with all the variations I tried (hours of Googling and trying this and that), but below was what finally worked for me to exclude a subdomain from being forced into https.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
#Exclude subdomain from rewrite rule
RewriteCond %{REQUEST_URI} !^/SubDomainName/
RewriteCond %{HTTP_HOST} !=SubDomainName.DomainName.com [NC]
#rewrite the url to force the use of https
RewriteRule ^(.*)$ https://DomainName.com/$1 [R=301,L]

 

So let explain the 2 critical new lines:

RewriteCond %{HTTP_HOST} !=SubDomainName.DomainName.com [NC]

This one is pretty self-explanatory, if a request is made to access SubDomainName.MyDomainName.com then you do not (!) apply the following Rewrite Rule.

RewriteCond %{REQUEST_URI} !^/SubDomainName/

This one on the other hand may not be so obvious.  My host was automatically redirecting request for

SubDomainName.DomainName.com

to

DomainName.com/SubDomainName

so I needed to add another Rewrite Condition to also exclude such a request from being forced into https.  You may not need to include this condition on how your host has things setup.

 

Robot.txt

One last additional tidbit.  While trying to figure out the above I came across a posting in which they stated that an exclusion for the robot.txt should be made so it does not require https.  To do so, you would add one more Rewrite Conditon

RewriteCond %{REQUEST_URI} !/robots.txt

 

So the final htaccess would then become

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
#Exclude robot.txt from rewrite rule
RewriteCond %{REQUEST_URI} !/robots.txt
#Exclude subdomain from rewrite rule
RewriteCond %{REQUEST_URI} !^/SubDomainName/
RewriteCond %{HTTP_HOST} !=SubDomainName.DomainName.com [NC]
#rewrite the url to force the use of https
RewriteRule ^(.*)$ https://DomainName.com/$1 [R=301,L]
</IfModule>

 

Resources

While trying to figure this all out, I came across a few good sites, should you wish to delve deeper into the matter:

Disclaimer
Let me be explicitly clear, I am not an htaccess experts by any means.  I simply managed to piece the above together out of personal necessity.  Just because it worked for me does not guarantee it will work for you, nor should any assumptions be made that it is the best approach to the matter.

As with any post on my site, I am always open to better ways of doing things, and learning, so feel free to leave a comment if you can add constructive information to the above.

Create an Apache Sub-Domain

Not long ago, I was looking information on how to create and configure an Apache sub-domain on my test server.  I found a number of websites covering the subject, but even after editing my httpd.conf file to add the domain and sub-domain entries, the sub-domain would not work!?  So I did more digging and testing and what I found was that the various tutorials and explanations all omitted one crucial element to the puzzle, none of them mentioned that you had to also add a subdomain entry to Windows’ host file! I assumed that since the domain already had an entry, Apache & Windows were smart enough to know that a sub-domain would use the same host entry as the domain, I was wrong! Apparently, Apache & Windows are not that smart, actually they appear to be blatantly stupid!

So the first thing you have to do is edit the httpd.conf file to add the required virtual host entries: 1 for the domain & 1 for the sub-domain


    ServerName www.domain.com
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/websites/www.domain.com"


    ServerName subdomain.domain.com
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/websites/www.domain.com/subdomainFolderName"

But even once this is done, you then have to go and make an entry for both your domain and another for your sub-domain in the Windows Host file.  The values below assume a local test server

127.0.0.1    www.domain.com
127.0.0.1    subdomain.domain.com

Once you make both of these changes, restart your Apache server, and everything should work.  It did for me at least!

Domain Registry of Canada – a SCAM?

I recently got a letter in the mail from Domain Registry of Canada indicating I had to renew 2 domains. Their letter, and envelop is as close as you can get to resembling official Government of Canada letterhead, but isn’t. Actually what then send out in an invoice for services, for which you have not yet even signed up for! But if you return the letter with payment you are in fact agreeing to switch your business over to them!

Domain Registry of Canada Letter
Domain Registry of Canada Letter

So what or who is Domain Registry of Canada exactly? They are merely a domain registrar, a company that offer the service of registering your website address (your .com, .ca, .net, …).

Continue reading