<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Underwater Design</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/" />
    <link rel="self" type="application/atom+xml" href="http://www.underwaterdesign.com/atom.xml" />
   <id>tag:www.underwaterdesign.com,2007://1</id>
    <link rel="service.post" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1" title="Underwater Design" />
    <updated>2007-04-27T01:29:42Z</updated>
    <subtitle>Informative information for PHP Developers, Linux Hosting, Search Engine Optimization, and just about anything web related. PLEASE View Site in FireFox (IE is the Devil)I might not be able to change the web world, but I can atleast make a dent!</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.2</generator>
 
<entry>
    <title>The Simple CMS&amp;#8482; has finally arrived</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2007/04/the_simple_cms_has_finally_arr.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=41" title="The Simple CMS&amp;#8482; has finally arrived" />
    <id>tag:www.underwaterdesign.com,2007://1.41</id>
    
    <published>2007-04-27T01:17:55Z</published>
    <updated>2007-04-27T01:29:42Z</updated>
    
    <summary>SIMPLE CMS&amp;#8482; is an application created by myself and my partner, Founders of Blue Oryx Internet Solutions, LLC. The goal was to create a truly Search engine optimized, and SIMPLE content management system. We have succeeded!. The SIMPLE CMS&amp;#8482; is...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="PHP Development" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p><span style="color:#06376f;font-style:italic;">SIMPLE CMS&#8482;</span> is an application created by myself and my partner, Founders of <a href="http://blueoryx.com">Blue Oryx Internet Solutions, LLC</a>. The goal was to create a truly Search engine optimized, and SIMPLE content management system. We have succeeded!.</p>

<p>The <span style="color:#06376f;font-style:italic;">SIMPLE CMS&#8482;</span> is exactly that, SIMPLE. Everything you need is right in front of your face. Need to create a page on your website? Go to "Create Page" and everything you need is right there. No need to go to multiple pages, to populate all aspects of the CMS for that page. meta tags, custom page naming, image uploads, etc. are on that page. You can create a page as fast as you can type it! It just doesn't get more SIMPLE!</p>

<p><a href="http://blueoryx.com">Blue Oryx Internet Solutions, LLC</a> also has a site solely dedicated to the <span style="color:#06376f;font-style:italic;">SIMPLE CMS&#8482;</span>. All Features, FAQs, Pricing and more can be found at <a href="http://www.thesimplecms.com">www.thesimplecms.com</a>.</p>

<p>I hope you find something you like and enjoy it as much as my other clients. Anyone, including my father, can make a website now!</p>]]>
        
    </content>
</entry>
<entry>
    <title>Installing PHP 5.1.4 and Apache 2.2.2 on a Mac</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/10/installing_php_514_and_apache_1.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=40" title="Installing PHP 5.1.4 and Apache 2.2.2 on a Mac" />
    <id>tag:www.underwaterdesign.com,2006://1.40</id>
    
    <published>2006-10-05T14:46:35Z</published>
    <updated>2006-10-07T16:36:33Z</updated>
    
    <summary>Install Apache 2 and PHP 5 open Terminal sudo to admin: sudo bash Turn off all instances of apache from terminal: sudo bash killall httpd curl -O http://apache.seekmeup.com/httpd/httpd-2.2.2.tar.gz gnutar -xzf httpd-2.2.2.tar.gz cd httpd-2.2.2 Run these commands within folder httpd-2.2.2 CFLAGS=&quot;-isysroot...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Linux Administration" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>Install Apache 2 and PHP 5</p>

<p>open Terminal<br />
sudo to admin:<b> sudo bash</b><br />
Turn off all instances of apache</p>

<p>from terminal:<br />
<b>sudo bash killall httpd</b></p>

<p>curl -O http://apache.seekmeup.com/httpd/httpd-2.2.2.tar.gz <br />
gnutar -xzf httpd-2.2.2.tar.gz </p>

<p>cd httpd-2.2.2</p>

<p>Run these commands within folder httpd-2.2.2<br />
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" sudo ./configure --prefix=/opt/apache2 --enable-mods-shared=all --enable-proxy-balancer --enable-proxy-ajp --enable-proxy-http --enable-proxy-ftp --enable-proxy-connect --enable-proxy --enable-ssl --enable-so</p>

<p>make<br />
make install<br />
------------------------------------------------<br />
Either through your browser or wget in terminal download:<br />
<b>http://www2.entropy.ch/download/entropy-php-5.1.4-5-apache2.tar.gz </b><br />
After installing, ignore error message. Rumor has it that if you use wget you will not get an error. I haven't tested this yet.</p>

<p>After Install completes, Place at bottom of /opt/apache2/conf/httpd.conf. <i> Remove backslashes from Tags below before saving config file.</i><br />
<b>LoadModule php5_module /usr/local/php5/libphp5.so <br />
<\IfModule php5_module> <br />
AddType application/x-httpd-php .php <br />
AddType application/x-httpd-php-source .phps <br />
DirectoryIndex index.html index.php <br />
<\/IfModule></b></p>

<p>change to your current default Sites folder. I use Sites</p>

<p>DocumentRoot "/Users/username/Sites"</p>

<p><Directory "/Users/username/Sites"></p>

<p>UserDir Sites</p>

<p>start Apache<br />
<b>/opt/apache2/bin/apachectl start</b></p>

<p><b>make apachectl accessible from anywhere</b><br />
/Users/username/.bash_profile</p>

<p>if it doesn't exist create it (vi or pico, etc)</p>

<p>add this line to it:<br />
<b>export PATH=/opt/apache2/bin/:$PATH</b></p>

<p>close terminal window, restart terminal </p>

<p><b>configure file: /usr/local/php5/lib/php.ini</b></p>

<p>changes to make:<br />
if you like to use < ?=  change short_open_tag to On</p>

<p>for debugging and seeing why your script isn't running<br />
<b>display_errors=On</b></p>

<p>You may want this too<br />
<b>expose_php=On</b></p>

<p>If you have a CMS and need to upload files via the web you will want to change this from 2M to what ever you want it too, i set mine to 5M<br />
<b>upload_max_filesize=5M</b></p>

<p><br />
now restart apache<br />
<b>apachectl restart</b>  or <b>apachectl graceful</b></p>]]>
        
    </content>
</entry>
<entry>
    <title>Banana Spider v1.0</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/banana_spider_v10.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=39" title="Banana Spider v1.0" />
    <id>tag:www.underwaterdesign.com,2006://1.39</id>
    
    <published>2006-06-15T02:21:26Z</published>
    <updated>2006-06-15T04:08:51Z</updated>
    
    <summary>Download the Banana Spider v1.0 - Google Sitemap Generator here You can read more about this PHP Google Sitemap Generator at PHP - Google Sitemap Spider - Banana Spider 1.0...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Downloads" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>Download the <a href="http://www.underwaterdesign.com/downloads/banana_spider_v1.zip">Banana Spider v1.0 - Google Sitemap Generator</a> here</p>

<p>You can read more about this PHP Google Sitemap Generator at <a href="http://www.underwaterdesign.com/2006/06/php_google_sitemap_spider_bana.php">PHP - Google Sitemap Spider - Banana Spider 1.0</a></p>]]>
        
    </content>
</entry>
<entry>
    <title>PHP - Google Sitemap Spider - Banana Spider 1.0</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/php_google_sitemap_spider_bana.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=38" title="PHP - Google Sitemap Spider - Banana Spider 1.0" />
    <id>tag:www.underwaterdesign.com,2006://1.38</id>
    
    <published>2006-06-15T01:58:57Z</published>
    <updated>2006-06-15T04:07:28Z</updated>
    
    <summary>I have created a Spider that will crawl your site and produce a sitemap.txt file for Google Sitemaps. Currently it uses PHP 4 and cURL 7.13.1 or higher with Regular expressions to crawl your site for links. It filters out...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="PHP Development" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>I have created a Spider that will crawl your site and produce a sitemap.txt file for Google Sitemaps.</p>

<p>Currently it uses PHP 4 and cURL 7.13.1 or higher with Regular expressions to crawl your site for links. It filters out all javascript, mailto, query string, https, un-used file extensions and non-domain links. It does not crawl directories, so you do not need to worry about logging image folders, admin folders, etc. It is 10 time easier than Google Sitemaps' tools.</p>

<p>Currently it only produces the .txt format with just a full URL per line. I have seen no advantage to the XML format as of yet since when you submit a site map to google it will crawl it when ever it gets to it anyway. From what I know Google is smart and if you have new content regularly it will crawl regularly on it's own. </p>

<p>The Banana Spider is easy to install and can be run from the browser or from a Cron Job. It requires you to modify the config.inc.php file with the URL you want to crawl and if you are tech savvy you can even modify the catches if you want to disallow more or less of what I have already. The README file contains Instructions and a Description of the features within Banana Spider v1.0.</p>

<p>I named this Sitemap Generator after the Banana Spider (Brazilian Wandering Spider) because this real life spider is as cool as spiders get. From South America, it is the most venomous spider of the New World. It is fast and aggressive, to be respected and admired. It is a crawler spider, Like this Sitemap Generator in a sense, it does not spin a web. Hence, the name Banana Spider!</p>

<p>Download the <a href="http://www.underwaterdesign.com/2006/06/banana_spider_v10.php">Banana Spider v1.0 - Sitemap Generator</a>. We are using it here and on many many other sites.</p>

<p>As I come across new requirements I will add them. If you have any suggestions let me know and I  will try and incorporate them as soon as I can. (i.e., More file extensions to disallow).</p>]]>
        
    </content>
</entry>
<entry>
    <title>SEO - Prevent Directory Listing with .htaccess</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/seo_prevent_directory_listing.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=37" title="SEO - Prevent Directory Listing with .htaccess" />
    <id>tag:www.underwaterdesign.com,2006://1.37</id>
    
    <published>2006-06-10T18:53:57Z</published>
    <updated>2006-06-10T19:16:31Z</updated>
    
    <summary>Most servers have this option disabled, however, some do not. This could leave to a security risk. Most of the time a directory list will appear if you do not have a Default index file in it. usually this happes...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Search Optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>Most servers have this option disabled, however, some do not. This could leave to a security risk. Most of the time a directory list will appear if you do not have a Default index file in it.  usually this happes to image folders (i.e., www.domain-name.com/images/). In the .htaccess file you can define exactly what you want to show if anything at all.</p>

<p>to hide everyrthing:<br />
<b>IndexIgnore *</b></p>

<p>To hide images:<br />
<b>IndexIgnore *.gif *.jpg *.png *.swf</b><br />
or what ever your file extensions are.</p>

<p>If you want to show directory listing, and the server has it disabled, you can add this little snippet to the .htaccess file:<br />
<b>Options +Indexes</b><br />
*** .htaccess overides the Apache config parameters ***</p>

<p>As you may have guess you can use the same line to Disable Directory listings as well. Just change the + to a -<br />
<b>Options -Indexes</b></p>

<p>For all you fancy pants out there that like to show off their stuff, here is a little trick for your list pages. You can include a description for the directory list that will be displayed when encounter a list page.  upload a file called HEADER in the directory which you will use for listing files. The contents of this file will be displayed before the list. You may also upload a footer, which is a file named README. Upload it in the same directory as the HEADER. The README file is displayed after the file listing.  Rememeber, HEADER and README have No Extensions  and are case Sensitive.  So trickey!<br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>SEO - Permanent Redirects 301</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/seo_permanent_redirects_301.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=36" title="SEO - Permanent Redirects 301" />
    <id>tag:www.underwaterdesign.com,2006://1.36</id>
    
    <published>2006-06-10T17:43:48Z</published>
    <updated>2006-06-10T18:42:26Z</updated>
    
    <summary>Permanent Redirect 301 is a way to tell the spiders bots that a site or page has moved permanently to a new location. This is crucial for keeping your rankings in organic searches. For example, you have a URL like...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Search Optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>Permanent Redirect 301 is a way to tell the spiders bots that a site or page has moved permanently to a new location. This is crucial for keeping your rankings in organic searches. For example, you have a URL like www.domain-name.com/photos/ and you change the URL to a sub-domain like photo.domain-name.com. If you do not tell search engines about this change then all the old indexed links and pages will error since they no longer exists and they will have to recrawl your site and re-index the new sub-domain.  Not good! The same goes for page name changes.</p>

<p>Use .htaccess to save the day!</p>

<p><b>Permanently Redirect to a Sub-domain</b><br />
<pre><code><br />
RewriteRule ^photos/(.*)$ http://photos.underwaterdesign.com/$1 [R=301,NC,L]<br />
</code></pre></p>

<p><b>Permanently Redirect to a New Page</b><br />
<pre><code><br />
RewriteRule ^photos/index.php http://www.domain-name.com/photos/index2.php [R=301,NC,L]<br />
</code></pre></p>

<p>Just repeat for each changed directory or page. This will tell spiders that this is the NEW PERMANENT location of the old page(s).</p>

<p>Wish there was more to tell but it is really just that simple!</p>]]>
        
    </content>
</entry>
<entry>
    <title>SEO - Friendly Dynamic URLs</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/seo_friendly_dynamic_urls.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=35" title="SEO - Friendly Dynamic URLs" />
    <id>tag:www.underwaterdesign.com,2006://1.35</id>
    
    <published>2006-06-10T15:44:29Z</published>
    <updated>2006-06-10T19:24:16Z</updated>
    
    <summary>A Dynamic URL looks like this: http://www.domain-name.com/index.php?id=1&amp;code=123&amp;product=15 This is not such a great idea for many reasons. First it is ugly, second it can be used to hacked your site or get others information if the site is not properly...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Search Optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>A Dynamic URL looks like this:<br />
http://www.domain-name.com/index.php?id=1&code=123&product=15</p>

<p>This is not such a great idea for many reasons. First it is ugly, second it can be used to  hacked your site or get others information if the site is not properly secured, and third, search engines don't like it. Google has a saying: id is NEVER indexed, 1 query string 90% change, 2 = 50%, more than 2 ... it's like shooting Craps!</p>

<p>So, how do we get around this? With .htaccess and <a href="http://www.itlab.musc.edu/docs/perl_regexp/" target="_blank">Regular Expressions</a>.  </p>

<p>Append this into your .htaccess file after where you set up <a href="http://www.underwaterdesign.com/2006/06/seo_htaccess_with_canonical_an.php" target="_blank">domain name redirects</a></p>

<pre><code>
# This code rewrites the url for every possible query result (for 1-3 at a time)
# I use this in my CMS
RewriteRule    ^([A-Za-z0-9-]+)/?$    index.php?id=$1     [L]
RewriteRule    ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$    index.php?id=$1&sub=$2  [L] 
RewriteRule    ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)-]+)/([A-Za-z0-9-]+)/?$    index.php?id=$1&code=$2&product=$3  [L] 

<p></code></pre></p>

<p>The code above looks for text after the domain name that matches index.php?id=[any value]  and the $1 is a temporary variable that that [any value] is assigned to. The same goes for the other 2 lines as well.</p>

<p>So when you have a link on your site that goes to:<br />
www.domain-name.com/1/123/15/</p>

<p>It takes the /1/123/15/ as /$1/$2/$3/ and behind the scenes where no one can see it is actually telling the script on index.php to GET these values "index.php?id=1&code=123&product=15". At the same time no one knows what programming language you wrote your site in so hacking is much more difficult.</p>

<p>Spiders automatically assume that www.domain-name.com/1/123/15/ is the same as www.domain-name.com/1/123/15/index.html, so it is not needed but if you want to  add index.html to your url all you have to do is add it here:</p>

<pre><code>
RewriteRule    ^([A-Za-z0-9-]+)/index.html?$    index.php?id=$1     [L]
RewriteRule    ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/index.html?$    index.php?id=$1&sub=$2  [L] 
RewriteRule    ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)-]+)/([A-Za-z0-9-]+)/index.html?$    index.php?id=$1&code=$2&product=$3  [L] 

<p></code></pre><br />
Your links on your site to your pages should look like this:<br />
1) < a href ="/1/123/15/index.html" > home < / a></p>

<p>and NOT like this:<br />
2) < a href = "index.php?id=1&code=123&product=15" > home < / a></p>

<p>Remember 1 is doing what 2 does now.</p>]]>
        
    </content>
</entry>
<entry>
    <title>SEO - .htaccess with canonical and Multiple Domains</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/seo_htaccess_with_canonical_an.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=34" title="SEO - .htaccess with canonical and Multiple Domains" />
    <id>tag:www.underwaterdesign.com,2006://1.34</id>
    
    <published>2006-06-10T14:35:43Z</published>
    <updated>2006-06-10T19:21:16Z</updated>
    
    <summary>.htaccess files are your best friend when it comes to Search engines. With multiple domains, .htaccess cleans up for you. Some rumors state that having multiple domains is good. This couldn&apos;t be more false. If you register the domain name...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Search Optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>.htaccess files are your best friend when it comes to Search engines. With multiple domains, .htaccess cleans up for you.  Some rumors state that having multiple domains is good.  This couldn't be more false.</p>

<p>If you register the domain name "domain-name.com", that is what you get. The www is added but Apache or IIS through name aliasing.  If you never specify in Apache that you ONLY want to use www.domain-name.com Google will spider both domain-name.com and www.domain-name.com.  This will hurt your rankings because you are creating duplicate content and Google will not be able to decide which is more relevant.</p>

<p>There are 3 ways to get around this problem. First, if you are very tech savy you can fix this issue immediately in the apache config file (httpd.conf). Second, if you hosting provider allows it, you can fix this in .htaccess (most providers do, if not contact them), and third is a nice little PHP hack I wrote up.  All of which I will show you now.</p>

<p><b>Apache (httpd.conf)</b><br />
In your Apache configuration file you will have a section for virtual hosts, add this to it:<br />
<pre><code><br />
< VirtualHost domain-name.com ><br />
  # Add this line<br />
Redirect 301 / http://www. domain-name.com/<br />
< / VirtualHost></p>

<p></code></pre><br />
Save the file and run apachectl configtest.  If all is okay you should be good to go.</p>

<p><b>.htaccess</b><br />
This file can be placed in any or multiple folders with different perameters set in each file. However, for this example we will place it in the Root or main directory of your website (public_html/.htaccess, htdocs/.htaccess).</p>

<p>In your favorite text editor All you have to enter is:<br />
<pre><code><br />
Options +FollowSymLinks<br />
RewriteEngine on</p>

<p>RewriteCond %{http_host} ^domain-name\.com [nc]<br />
RewriteRule ^(.*)$ http://www.domain-name.com/$1 [R=permanent,nc,L]</p>

<p></code></pre></p>

<p><b>PHP</b><br />
Finally if worse comes to worse and you cannot use Apache or .htaccess, I have your solution!!!!  PHP to the rescue!<br />
Add this before any HTML or text is printed on your site:<br />
<pre><code><br />
// redirect to one URL -- takes the place of mod rewrite in htaccess<br />
for($i=0; $i <= count($domains); $i++){<br />
	<br />
       if($_SERVER['HTTP_HOST'] ==  'kidswireless.com'){<br />
           header("Location: http://www.kidswireless.com".$_SERVER['REQUEST_URI']."");<br />
       }<br />
}</p>

<p></code></pre></p>

<p>You can also use this if you have multiple domains like domain-name.com and domainname.com. You more than likely do not want to have both sites since this could hurt you more than help you.</p>

<p>So for each domain you have you must enter the RewrireCond and RewriteRule. You cannot place multiple conditions to one rule (so I found out the long way).</p>

<p>Here is what a .htaccess looks like for 2 domains being pointed to one domain:<br />
<pre><code><br />
Options +FollowSymLinks<br />
RewriteEngine on</p>

<p>RewriteCond %{http_host} ^domain-name\.com [nc]<br />
RewriteRule ^(.*)$ http://www.domain-name.com/$1 [R=permanent,nc,L]</p>

<p>RewriteCond %{http_host} ^domainname\.com [nc]<br />
RewriteRule ^(.*)$ http://www.domain-name.com/$1 [R=permanent,nc,L]</p>

<p>RewriteCond %{http_host} ^www\.domainname\.com [nc]<br />
RewriteRule ^(.*)$ http://www.domain-name.com/$1 [R=permanent,nc,L]</p>

<p></code></pre></p>

<p>Notice we did one for domainname.com and www.domainname.com and only in the first line did we use the "\" to escape the ".". This is part of Regular Expressions, which is a language used to parse through strings and retrieve values.</p>

<p>That was just the first step to cleaning up your site for Search Engine Optimization, however, it is a very important step!<br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>SEO - Overview Organic search</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/seo_overview_organic_search.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=33" title="SEO - Overview Organic search" />
    <id>tag:www.underwaterdesign.com,2006://1.33</id>
    
    <published>2006-06-10T14:05:31Z</published>
    <updated>2006-06-10T14:28:56Z</updated>
    
    <summary>Overview of Google Organic Search Over the years Google has made many steps to optimize its filters to bring you the best possible results. This is good and bad at the same time. It is good because you don&apos;t get...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Search Optimization" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>Overview of Google Organic Search</p>

<p>Over the years Google has made many steps to optimize its filters to bring you the best possible results.  This is good and bad at the same time.  It is good because you don't get a lot of junk in your searches, it is good because it gives everyone a fair chance to rank high, and it is good because it gets rid of a lot of spammer sites. It Is BAD because there are many, many things you have to take into consideration to rank well, it is bad because if you do it wrong you could get banned and not even know why.</p>

<p>However, We deal with SEO (Search Engine Optimization) on a daily basis here and I will try and share everything I have learned with you. This section will discuss everything from tagging to Google analytics for tracking. I will even share lots and lots of technical info with you about .htaccess and using 301 redirects to keep you site in rank even if you change a URL to a page.</p>

<p>Search engine optimization takes patience and attention to detail. Don't try and cheat by cloaking your site, which is producing different content to Google then the viewers see, or creating link farms, which is tons and tons of links on one page (be careful with your sitemap pages).  </p>

<p>We will concentrate on google in this section for 2 reasons; 1) Its free!!!, 2) 85%+ of my traffic comes from there.  We will discuss Overture (Yahoo, etc.), but because they make you "pay to play", I will keep it limited.</p>

<p>Remeber, Google offers services that can get you well on your way, such as Google Sitemaps and Google Analytics which will be discussed in greater detail within this section. So, sit back and enjoy, and get ready to charge your clients an extra 10 dollars an hour or more for your expertise in Search Engine Optimization!!!!!</p>]]>
        
    </content>
</entry>
<entry>
    <title>MySQL - Create  Database Backup file</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/mysql_create_database_backup_f.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=32" title="MySQL - Create  Database Backup file" />
    <id>tag:www.underwaterdesign.com,2006://1.32</id>
    
    <published>2006-06-09T19:12:36Z</published>
    <updated>2006-06-09T19:36:57Z</updated>
    
    <summary>To create a Database back up from Line command MySQL it only takes one line of code. Just define the database, your credentials adn where you want to put the file. If you run the command from within the folder...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="MySQL Administration" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>To create a Database back up from Line command MySQL it only takes one line of code.<br />
Just define the database, your credentials adn where you want to put the file.  If you run the command from within the folder you want to place the file you do not need the path to the folder.</p>

<p>We will show with the full path to the folder to keep the backup file.</p>

<pre><code>
mysqldump --opt -h localhost-u username -p password Database_Name | gzip > /home/username/backups/backup_06_01_2006.gz;

<p></code></pre></p>

<p>If you want to just backup to a regular file and not a compressed file remove " | gzip" and drop the .gz extension on the file name</p>

<p>See how to do this with PHP and/or Crontab at: <a href="http://www.underwaterdesign.com/2006/06/php_mysql_backup_script_for_cr.php">PHP - MySQL Backup script for Crontab</a></p>]]>
        
    </content>
</entry>
<entry>
    <title>PHP - MySQL Backup script for Crontab</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/php_mysql_backup_script_for_cr.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=31" title="PHP - MySQL Backup script for Crontab" />
    <id>tag:www.underwaterdesign.com,2006://1.31</id>
    
    <published>2006-06-09T18:58:48Z</published>
    <updated>2006-06-09T19:11:52Z</updated>
    
    <summary>Here is a script that will allow you to backup your database whenever you want to. Just set a Cron Job to point to this script and you are golden!!! Be sure to change the variables to your values before...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="PHP Development" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>Here is a script that will allow you to backup your database whenever you want to.  Just set a Cron Job to point to this script and you are golden!!! Be sure to change the variables to your values before trying to run this.</p>

<p>See more about <a href="http://www.underwaterdesign.com/2006/06/linux_crontab_create_edit_list.php">Cron Jobs </a></p>

<pre><code>
// database back up with email notification
// Use Crontab to automate
// make file executable

<p>// Define your parameters, <br />
// Best defined in a include file for security purposes<br />
$host = "localhost";<br />
$username = "root";<br />
$password = "password";<br />
$dbname = "database_name"</p>

<p>// define the file name<br />
$backup = $dbname.date("Y-m-d_H:i:s").'.gz';<br />
// define the path to the file<br />
// we puposely do this outside the web directory<br />
$path = "/home/username/backups/";<br />
// combine into one string<br />
$backup_file = $path.$backup;</p>

<p>// for email<br />
$email = "myemail@domain.com";<br />
$subject = "MySQL Dump Completed succesfully";<br />
$body = "You MySQL back up for $backup is available at:\n\n $backup_file\n\n"<br />
$body.= "thank you,\n Your friendly Linux Box!";</p>

<p>// the mysql command<br />
$command = "mysqldump --opt -h $host -u $username -p $password $dbname | gzip > $backup_file";</p>

<p>// Now that all that is defined lets run the script<br />
if(exec($command)){ // run the command<br />
	if(file_exists($backup_file)){<br />
		mail($email, $subject, $body);<br />
	} else {<br />
	// redefine some variables for mail<br />
		$subject = "MySQL Dump Failed miserably";<br />
		$body = "You MySQL back up for $backup Failed:\n\n $backup_file\n\n"<br />
		$body.= "So Sorry,\n Your friendly Linux Box!";</p>

<p>		mail($email, $subject, $body);<br />
	}<br />
} else {<br />
	$subject = "Failed to execute command";<br />
	$body = "You MySQL back up for $backup Failed to execute:\n\n $command\n\n"<br />
	$body.= "So Sorry,\n Your friendly Linux Box!";</p>

<p>	mail($email, $subject, $body);</p>

<p>}<br />
</code></pre></p>

<p>Here is what you put into your crontab file:<br />
we assume you are running this file from outside your web directory (public_html, htdocs) in a folder called backups that you have already created. This runs the script at 1am every sunday</p>

<p><strong>0 1 * * 0 usr/bin/php /home/username/backups/database_backup.php >/dev/null 2>&1</strong></p>

<p>Remember you must have permission to write Cron Jobs on your server. Contact you hosting provider for more information.</p>

<p>Here is some info that will teach you how to create a Dynamic Cron Job from your browser if you wish to be able to change this from an administration area: <a href="http://www.underwaterdesign.com/2006/06/php_create_a_cron_job_with_php.php"> Create a Cron Job with PHP</a><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>MySQL - IGNORE Duplicate Entries</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/mysql_ignore_duplicate_entries.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=30" title="MySQL - IGNORE Duplicate Entries" />
    <id>tag:www.underwaterdesign.com,2006://1.30</id>
    
    <published>2006-06-09T16:07:33Z</published>
    <updated>2006-06-09T17:11:08Z</updated>
    
    <summary>If this were a perfect world, all data recieved would never have a duplicate key. It obviously isn&apos;t a perfect world sinc MySQl created this little function (IGNORE). Lets say i get a data dump and in it it has...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="MySQL Administration" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>If this were a perfect world, all data recieved would never have a duplicate key. It obviously isn't a perfect world sinc MySQl created this little function (IGNORE). Lets say i get a data dump and in it it has these 2 rows:<br />
<B>1   2   productname    product description     3<br />
1   2   productname    product description (sub description)    3  </b></p>

<p>They are not identical but the primary keys are. Since primary keys have to be unique this throws an error.</p>

<p>here is how we get around this error:<br />
<pre><code><br />
 $sql = "INSERT IGNORE INTO ".$table." (".$column.") VALUES (".$value.")";<br />
</code></pre><br />
Ths will drop the second line and continue on with the script. </p>

<pre><code>
 $sql = "INSERT INTO ".$table." (".$column.") VALUES (".$value.")"
  ON DUPLICATE KEY UPDATE ".$column[0]."=".$column[0]+1"";
</code></pre>

<p>This will update the previous row. Most of the time you do not want to change a primary key if the data is dumped to you.  So i cannot stress to you enough to emphasize to your datafeed distributer to give you nice, clean dumps!!!</p>]]>
        
    </content>
</entry>
<entry>
    <title>MySQL -  how to ignore Key constraints</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/mysql_how_to_ignore_key_constr.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=29" title="MySQL -  how to ignore Key constraints" />
    <id>tag:www.underwaterdesign.com,2006://1.29</id>
    
    <published>2006-06-09T15:17:59Z</published>
    <updated>2006-06-09T15:33:45Z</updated>
    
    <summary>In one of my scripts I have to do a mass upload of inserts, updates and deletes to a innoDB database. If I do not process these files in a proper table order, I will get a key constraint error....</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="MySQL Administration" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>In one of my scripts I have to do a mass upload of inserts, updates and deletes to a innoDB database.  If I do not process these files in a proper table order, I will get a key constraint error. A solution to get around this is to simply run this code before you run your insert, update or delete statement.</p>

<pre><code>
// make sure you have already established a connection to a database... then:
$sql_key = 'SET FOREIGN_KEY_CHECKS=0';
mysql_query($sql_key) or die('Could not Insert values: '.mysql_error());

<p>// then run your insert statement<br />
</code></pre></p>

<p>I use this code because I get my table list from file names on a FTP server. This comes to me in alphabetic order, which is obviously not the proper table order. So when I automate the inserts it inserts in the FTP list order and will throw errors.</p>

<p>This isn't the greatest solution since you may end up with some currupted indexes if the data is perfect when you receive it.  But if you cannot find another soluion, this will work.  Just make sure the data you receive is clean!</p>

<p>We are currently working on a script that will reorder the FTP list array to thee proper table order. I will post it as soon as I figure that monster out.</p>]]>
        
    </content>
</entry>
<entry>
    <title>MySQL Administration and Techniques</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/mysql_administration_and_techn_1.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=28" title="MySQL Administration and Techniques" />
    <id>tag:www.underwaterdesign.com,2006://1.28</id>
    
    <published>2006-06-09T14:49:43Z</published>
    <updated>2006-06-09T14:50:15Z</updated>
    
    <summary>Below we will share with you all kinds of hard to find MySQL information. We will include SQL statements and MySQL administration statements such as ALTER TABLE and ADD FORIEGN KEY and all that jazz. Also we will show you...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="MySQL Administration" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>Below we will share with you all kinds of hard to find MySQL information.  We will include SQL statements and MySQL administration statements such as ALTER TABLE and ADD FORIEGN KEY and all that jazz. Also we will show you how to use MySQL functions to cut your script load in half which will put the work in MySQL's hands and speed up your scripts.</p>

<p>Alot of what we post here is what we actually use. through our trials and tribulations we have found many answers to hard to answer MySQL common tasks for Database administrators.</p>

<p>Hope we can help!</p>]]>
        
    </content>
</entry>
<entry>
    <title>PHP - Multiple Image Uploader 1.0</title>
    <link rel="alternate" type="text/html" href="http://www.underwaterdesign.com/2006/06/php_multiple_image_uploader_10.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.underwaterdesign.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=1/entry_id=26" title="PHP - Multiple Image Uploader 1.0" />
    <id>tag:www.underwaterdesign.com,2006://1.26</id>
    
    <published>2006-06-09T13:18:03Z</published>
    <updated>2006-06-09T13:57:56Z</updated>
    
    <summary>The attached file is a Zipped script that allows you to upload multiple files at once. The file is commented to help you set up. File Uploader 1.0...</summary>
    <author>
        <name>Vincenzo</name>
        <uri>www.underwaterdesign.com</uri>
    </author>
            <category term="Downloads" />
    
    <content type="html" xml:lang="en" xml:base="http://www.underwaterdesign.com/">
        <![CDATA[<p>The attached file is a Zipped script that allows you to upload multiple files at once. The file is commented to help you set up.</p>

<p><a href="http://underwaterdesign.com/downloads/upload-images.zip">File Uploader 1.0</a></p>]]>
        
    </content>
</entry>

</feed> 

