Blog Post default image

Ran into this little problem the other day when using someone else’s specific syntax. Returning a complex object using a notation that puts objects brackets onto new lines was throwing an error. I sat there staring at it for maybe like 20 minutes wondering what the hell I’d been drinking recently and why I couldn’t trace the error.

Turns out it was a very simple syntax pit fall I hadn’t come across before, because I’m a Person A in the example below with regards to formatting my scripts.

// Person A's format
function() {
 // function bracket on same line as declaration 
}

// Person B's format
function() 
{
 // function bracket on new line 
}

You can argue which is better all you want but likely you will run into both forms as a developer, both have their merits, and neither saves compile time.

So if you are a person B or just forced to use that format when defining objects, there is a catch you should know about.

Keep Reading...

How to make pretty seo urls via .htaccess in Apache

I will keep this post very short and sweet.

You can easily remove file extensions, in this case ‘.php’ from your urls, so that your urls are easy to remember, provide top SEO results and value, look pretty without file extensions, represent your architecture and are easy to change or redirect?

Pretty urls with no .php extension
{code type=html}

www.mysite.com/subsection/
www.mysite.com/subsection/page
{/code}

Ugly urls with extensions
{code type=html}

www.mysite.com/subsection/index.php
www.mysite.com/subsection/page.php
{/code}

Keep Reading...

Blog Post default image

If like me you are a bit of perfectionist when it comes to your web-sites and their SEO value, then you may eventually run into this problem.

You have gone to the effort of creating a nice .htaccess file for apache which removes the extensions of your webpages so you get nice pretty urls like

Pretty urls example
{code type=html}

www.mysite.com/subsection/
www.mysite.com/subsection/page


www.mysite.com/subsection/index.php
www.mysite.com/subsection/page.php
{/code}

See this post on how to create those pretty urls above
How to make pretty seo urls via .htaccess

You may also have installed WordPress or may be using it the way I do via an include header

The Problem
{code type=php}
define(‘WP_USE_THEMES’, false);
require($_SERVER[‘DOCUMENT_ROOT’] . ‘/blog/wp-blog-header.php’);
{/code}

Then one day you spidered your own site to make sure Google could index you correctly, all of a sudden you may have been surprised to find all your pretty urls, returning nasty 404 page not found errors in the header of your requests, even though you can browse to them and there are no apparent connection issues.

Well guess what is happening?

Keep Reading...