Friday, May 15th, 2009

URI Structure: SEO vs. Scalability

seo vs. scalability

Most popular permalink format among bloggers is date based. But many SEO experts would advise you against it . To make URIs short and keyword rich, they suggest the structure /category/post-name/ or just /post-name/

So, what’s the problem?

What an apostrophe can do to your site?

you'llHTML Special Character #39 – The Apostrophe: In this article, Thomas Shaw shows the screenshots of different job sites just after entering the word you’ll into search forms.

If you do not encode special characters in web forms, you run the risk of breaking the search query or the ability to insert malicious code into the database.

Tip: In PHP, always use mysql_real_escape_string function to sanitize data.

Using WordPress functions in External Files

if you want to use WordPress functions in external PHP scripts, you can do it by including wp-blog-header.php file. But the script may send “404 File not Found” header in some cases. For example, if you name it ‘index.php’, put it in a directory and call the directory, the page may appear in your browser, but using a header checking tool like web developer toolbar, you can see that it actually sends 404 headers. The same thing happens if you use mod_rewrite to do internal redirection to your script. Your page will not get indexed by Search Engines.

The fix: add “200 OK” header.


require('/path/to/wordpress/wp-blog-header.php');
header("HTTP/1.1 200 OK");
/* Your code  goes in here */