Although I understand why potential clients might dislike the thought of single page sites, they can often be the best implementation choice and many sites prove that less can equal more.
A short while back, we chose to redesign & restructure a multi-page site into a single page and our desire for perfection insisted that we account for the IBLs it had accumulated. Ignoring them would have effected human users as well as search engines.
So we put together an htaccess file which I am now presenting to you. It was necessary for that project, but I think it can surely benefit all single page sites as a cherry on the cake.
RewriteEngine On RewriteCond %{SCRIPT_FILENAME} -f RewriteRule ^.+\.(css|js|png|gif|jpg)$ - [L] #Include file extensions as needed RewriteCond %{THE_REQUEST} !\ /(\?.*)?\ [NC] RewriteRule . /? [R=301,L]
What does it do?
In a nutshell, the script does away with 404s so that any attempts at visiting sub-pages get redirected back to the main page. Doing so…
- Cuts down design time otherwise wasted creating 404 pages.
- Improves UX by saving users from dealing with needless 404 pages.
- Protects SEO value being lost on IBLs that point to 404 pages.
- Does away with the non-canonical derivitive of the site’s url (i.e. example.com/index.html).
Is it really useful?
Yes! Before setting out to publish this article, we did a little check on just over 100 randomly selects sites of the 800-odd listed at One Page Love handled non-existant pages. 85% returned 404s, suggesting that the idea was only considered by a few! ((Download the results of this survey here))
Summary
Clients are easily pleased with visuals and have little idea about technicalities. As their developer/designer, you’re being trusted to do what’s best for them. So, even if they don’t understand or appreciate it, applying this htaccess file will definitely add to the perfection (which you should always be delivering).
Have you ever develop a single page site? Will you find this useful? Be sure to let me know as I’d love to hear about it.
This entry was written by Fahed Bizzari. Fahed is a British-born entrepreneur and the master-mind behind Online Associates, a newly created internet consultancy in the UAE trying to revolutionise the Middle East’s online landscape.