Website Designers and Webmasters

Dedicated to all the tasks Webmasters, Website Developers and Website Designers find themselves facing.

By: Ashton Sanders

Redirecting Page Extensions with htaccess

Jun 14 16:26

Filed under: PHP, SEO, htaccess

If you are not familiar with htaccess, you are missing out. It is one of the greatest things about linux/php hosting. One little file that gives you a wide range of control. Here is one of the most useful parts of htaccess:

Redirecting Many Pages From .html to .php (or “/”) at Once

Today, I am finishing converting a static, HTML website to Wordpress. So all 58 pages that used to be /page.html are now /page/ and it would be a pain to go through all of the .html pages and force redirects to their new page. I found this page on Web Weaver that explains this well:

Changed file extension?

This example is perfect if you’ve decided to switch to .php from .html pages. It will look for any .html page and redirect it to .php (ie http://www.example.com/yourpage.html and redirect it to http://www.example.com/yourpage.php). Now, be careful with this, it does mean any html page. I did this on one of my sites and had totally forgotten I had an iframe with .html content on some pages… I didn’t notice for weeks that it was broken :S.
So learn from my mistake ;-) check, double check, then check again.

RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php

In my case, I put most of the pages into a subfolder (and without .php) so my htaccess redirect looks like this (example website for placeholder):

RedirectMatch 301 (.*)\.html$ http://www.websitesinaflash.com/website-services$1/

In this example, the $1 get’s replaced with everything from the (.*) which is everything after the domain name and before the .html.

Enjoy,
Ashton Sanders

By: Ashton Sanders

What CMS Fits Your Website Needs?

May 16 14:49

This is a question I’ve been asking for a few years.

Recently, I’ve heard a lot about Wordpress, Joomla, and Drupal, but it’s practically impossible to find someone who knows all three and is unbiased enough to tell you the pros and cons of each.

Through Montana Programmers, I’ve been able to find a very unbiased Polson Website Developer who has been an excellent resource for asking all sorts of random questions. Although he knows more programming languages than I have fingers and toes, he hasn’t spent years of time testing out CMS’s. ;)

As you can tell, it’s pretty hard to find a unbiased website developer who knows a lot about many of the Content Management Systems, who could give me a good comparison of the Pro’s and Con’s of each. There are a few problems here:
Continue Reading…

By: Ashton Sanders

mssql_connect(): unable to connect to server:

Aug 31 15:33

Filed under: PHP, SQL

I have a PHP script that I run locally (on my Windows XP Machine) that accesses a MSSQL server using the mssql_connect() function. I used xampp to get PHP on my machine.

Today I finished getting this to work on my second computer. The first time I did this, I also ran into a million problem – but didn’t note any of them. So here I am rectifying my previous mistakes in the hope of not having to search for the same solution next time.

The error I was getting was:

mssql_connect(): unable to connect to server: ‘www.ashtonsanders.com’

(Domain changed for security purposes.)

I handled it by replacing ntwdblib.dll with this ntwdblib.dll.zip in these two folders:

xampp/php
xampp/apache/bin

Enjoy!
-Ashton Sanders
(Note: algorytmy.pl was the final website that helped me handle my problem.)

By: Ashton Sanders

Simple PHP Blog

Mar 16 12:58

Filed under: Blogging, PHP, Review

I have already done a lot of ranting and raving about Blogger and Wordpress.

Although I consider these two to be the leaders of the blogging pack (by a large margin), I did run across a blog using Simple PHP Blog, and was impressed. It doesn’t have all the crazy features like the other two, but it does have a feature which really attracted my attention. On the bottom of every post there are five dots, and you can rate the post 1 to 5. This way, people can interact with your posts and website without actually having to write a comment.

Don’t get me wrong, the comment function is still intact, but the percent of comments compared to visitors is tiny, while the percent of “ratings” to visitors is much higher.

Another note: Simple PHP Blog isn’t database driven. You can run it on a server without needing a database!

If anyone ends up using this system, please let me know how it goes.
-Ashton Sanders

By: Ashton Sanders

PHP – Finding the Width or Height of an Image

Dec 22 16:22

Filed under: HTML, PHP, Website Design

Knowing the width, height, Image type or attributes of an image can be extremely useful.

I’ve used this once to make a line of images all line up on the bottom. I found out the height of the image and then added a margin to the top of the image to make the bottom of the image always be 300 px from the to. So if the height of the image was 140, I would make the margin on top of the image = 300-140.

Here’s the code to find the height or width of an Image:

<?php

list($width, $height, $type, $attr) = getimagesize(”image_name.jpg”);

echo “Image width ” .$width;
echo ”
“;
echo “Image height ” .$height;
echo ”
“;
echo “Image type ” .$type;
echo ”
“;
echo “Attribute ” .$attr;

?>

Enjoy,
Ashton Sanders

Older Posts »
RSS

Where Am I?

You have found the semi-coherent ramblings of Ashton Sanders: a website designer, developer and webmaster. This is primarily Ashton's place to save notes about techniques and things that he learns in his never-ending conquest of the internet. Hopefully it's coherent enough to be useful to you too.

Subscribe:

Enter your email to get automatic emails whenever Ashton posts on the blog.

Email:

Advertisers:

Email Marketing $19/Month! OIOpublisher Learn how to make Money from Blogging Hillarious, High-Quality Shirts for $6/each Great Book Keeping and Invoicing Software Advertiser Here

Tags and Categories

Links

Blog Roll