Archive for the 'Coding' Category

Mod_Rewrite for GoDaddy and WordPress

Maya is Driving

I didn't know what image to use for this post

Back in 2008 I posted an article about getting mod_rewrite working on a GoDaddy account. I thought it’d be a good time to update that information with another example. This time we’re going to be looking at making some changes on a GoDaddy account with a WordPress installation.

—————————————-
Options +FollowSymLinks
Options -MultiViews
RewriteEngine on
RewriteRule ^DirectoryName/(.*)/(.*)/(.*) pagename.php?paramB=$2&paramC=$3paramA=$1

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
DirectoryIndex index.php

Options +FollowSymLinksOptions -MultiViewsRewriteEngine onRewriteRule ^attorneys/(.*)/(.*)/(.*) practice.php?geo=$2&pa=$3&state=$1
# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>
# END WordPress
DirectoryIndex index.php

—————————————-

This implementation takes this: “domain.com/pagename.php?paramB=Y&paramC=ZparamA=X”
and turns it into “domain.com/DirectoryName/X/Y/Z ”

I like this set up since it fits in with my normal WordPress url structure. Just make sure that you pick a directory name that isn’t going to be used within WordPress.

Also, notice that the custom rules are inserted before the usual WordPress rules. This was the only way I was able to get it to work.

Hope this helps! Just let me know if you have any questions at all.

Skittles Sitelinks Update

Skittles has finally fixed their IE sitelinks problem.

Now their homepage is the Wikipedia page. Wins the award for most annoying navigation evar!

Makes Hulk want to smash rainbow!!!

Skittles Fails The Sitelink Rainbow

Do a search for “skittles” in Google using IE.

None of the sitelinks work. They all redirect in Firefox and Chrome.

Discuss amongst yourselves.

UPDATE: I did a little digging and it looks like their 404 page isn’t firing in IE. I used Tamper Data in FF and right after you click on one of the sitelinks it successfully launches
Content-Location=http://www.skittles.com/404.htm?404;http://www.skittles.com:80/products/index.jsp.

Then it eventually makes it’s way to
Content-Location=http://www.skittles.com/default.htm

Using HTTPWatch in IE, you never get to the 404 page.

+ 0.000 0.376 1066 503 GET 302 Redirect to http://www.skittles.com/fun/index.jsp http://www.google.com/url?q=http://www.skittles.com/fun/index.jsp&ei=EXytSeqfI4yRngfFzeW_Bg&sa=X&oi=smap&resnum=1&ct=result&cd=2&usg=AFQjCNFBsnbVEMPDmMqs_1qjSwNl19tWSg

+ 0.377 0.017 0 0 GET (Cache) text/html http://www.skittles.com/fun/index.jsp

0.395 1066 503 2 requests

My question is why is it going to the 404 at all? Why not just have the pages work? Is it a function of using Facebook to run everything?

GoDaddy .htaccess mod_rewrite is working!!!

Ok, so I know this is a little out of the blue but a recently acquired SEO client is using GoDaddy for their hosting. Their domain name is something to the effect of www.chicago(businesstype).com. I’ve only been optimizing the site for a couple of weeks and we’re already doing well for keyword phrases using “chicago.”

However, the client wants to attack markets in the surrounding suburbs so I needed to come up with a quick way to create “city pages” for each new market. I did this by using www.domain.com/cityPage.php?city=name. Easy enough…but i needed something friendlier for Google. Enter mod_rewrite for GoDaddy.

I searched around online until I found this combination which works for me.
Original URL: www.domain.com/cityPage.php?city=name (meh)
New URL: www.domain.com/name (wonderful!)

Here’s the magic code!
Options FollowSymLinks
Options -MultiViews
RewriteEngine on
RewriteRule ^([^/.]+)/?$ /cityPage.php?city=$1 [L]

You can see this code working at theĀ Chicago Title Loans site (www.chicagotitleloans.com)

Enjoy!

thx to the following sites for your help!
http://gidden.net/tom/2006/05/26/4/
http://surf11.com/entry/153/godaddy-hosting-mod-rewrite-with-htacces
http://www.btjones.com/2007/12/09/godaddy-mod_rewrite-problem-fix/
http://www.webmasterworld.com/apache/3380566.htm