Posts Tagged with “web development”

Setup MAMP and Parallels to test Windows browsers on Mac

Had to figure this out earlier today and figured others might be looking for an answer too. I am assuming that:

  1. You are using MAMP with the default ports (80 for Apache)
  2. You are using Parallels with Windows 7 (although these steps should work for older versions too)

Step 1: Setup your local environment with MAMP

This step is pretty straightforward. If you put your website in /sitename should be able to load it at http://localhost/sitename/.

Here’s a helpful tutorial. Don’t forget to set your Apache and MySQL ports to the default 80 and 3306.

Step 2: Figure out your Mac’s IP address on the network

Go into your Mac’s Network Preferences. You’ll see 2 or more connections on the left and the active one will say Connected. Click on it and you’ll see the IP address on the right side of the pane.

To make sure your Mac’s IP address doesn’t change, click on Advanced → TCP/IP. The options sheet below appears.

Network_Preferences

Change the IPV4 option to Using DHCP with manual address and type in an unused IP address. In the example above I used 192.168.1.100. Read More »

Solved: Cufon text not refreshing on jQuery UI Tabs

Update: I no longer use Cufon in my projects and prefer @font-face. If you are struggling with Cufon it will actually be faster for you to replace it with @font-face than to figure out your Cufon problems. Start with this tutorial here: The Essential Guide to @font-face

Today I was working on a project that:

  1. Made use of jQuery UI Tabs through the WordPress Post Tabs plugin
  2. Uses custom fonts for the tabs via Cufon
  3. Requires tab font to change color when selected

Read More »

Bulletproof domain redirection for CPanel Add-On domains

Recently I helped my friend Beth Heavrin of Smart Green Tips to migrate her blog to a new domain name. Along the way I realized that the simple way of domain redirection doesn’t work as well for websites that are add-on domains in CPanel environments. This article shows you how to create bulletproof redirects that will work, even for add-on websites.

The Problem

CPanel site structure

In CPanel environments, you start off with a primary domain that resides in the public_html directory. When you add new site to your CPanel hosting, they are added as add-on domains whose root folder are subdirectories of public_html.

You end up with a directory structure in your web hosting account like the image on the right.

Simple .htaccess Redirects Don’t Work

For our example, let’s assume that the primary domain is PrimaryDomain.com and the new domain we want to redirect it to is AddOn1.com. To redirect PrimaryDomain.com to AddOn1.com, you may have used this code in the .htaccess file for PrimaryDomain.com:

# Redirect 301 / http://www.AddOn1.com/

Or, you may have used this code:

# RewriteRule ^(.*) http://www.AddOn1.com/$1 [R=301,L]

With the code above, PrimaryDomain.com will get redirected to AddOn1.com. But unfortunately visitors to AddOn2.com will be wrongly redirected to AddOn1.com/AddOn2.com. Same for other add-on domains within the public_html directory.

This is because AddOn2.com is a subdirectory of public_html. The 2 code snippets above redirect everything, including add-on domain subdirectories to AddOn1.com. Confused? Never mind! Just use the solution below.

The Solution

The solution is to check the hostname (URL) that the visitor is trying to visit before redirecting them. So, let’s update our .htaccess file to the following:

# Redirect PrimaryDomain.com to www.AddOn1.com
RewriteCond %{HTTP_HOST} ^PrimaryDomain.com$
RewriteRule ^(.*)$ http://www.AddOn1.com/$1 [R=301,L]

#Redirect www.PrimaryDomain.com to www.AddOn1.com
RewriteCond %{HTTP_HOST} ^www.PrimaryDomain.com$
RewriteRule ^(.*)$ http://www.AddOn1.com/$1 [R=301,L]

The first block of rules only redirects visitors to PrimaryDomain.com and the second block only redirects visitors to www.PrimaryDomain.com. Visitors to AddOn2.com or AddOn3.com will not be redirected. Solved!

Restarting MAMP when it gets stuck

I’m a big fan of MAMP and use it to create development environments on my MacBook for websites I’m building. Ocassionally I run across a problem where the Apache and MySQL servers are stuck. What I mean is that MAMP says they’re on, but they’re not. And clicking the Stop/Start servers button doesn’t work. This usually happens when your system crashes with MAMP still running.

To fix it, simply go into MAMP preferences and click Reset MAMP Ports. Your Mac may ask you to enter your password. After that, click Set to default Apache and MySQL ports. Now you should be able to start/stop your servers again. Happy times 🙂