The Urbano A. Company’s Blog
Remove/Add the www? | SEO Tips:
I'm sure you all have seen how some sites have www, some not, and do you? Because for most web developers this might not seep as an important thing, even though it is essential. If you don't have chosen one, you may end up with a www.yoursite.com with PR 3 and yoursite.com with PR 1 for example.
Now to avoid this you must first decide what do you prefer, with or without. I personally like it without...
Google tools:
A very important one, go to Google Webmaster Tools, claim your site, and there you have the option to display the www. in searches or not.
Using .htaccess
Another way is by using mod_rewrite in .htaccess.
To use this option, create or edit your existing .htaccess file and add the following lines:
Adding www:
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
Remember to change domain.com with your domain!
Removing www:
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
More information about mod_rewrite and code snippets
Using php
Add the following script to the very top of your page, before anything else!
Adding www:
< ?php if (substr($_SERVER['HTTP_HOST'],0,3) !== 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.urbanoalvarez.es'.$_SERVER['REQUEST_URI']); } ?>
Removing www:
< ?php if (substr($_SERVER['HTTP_HOST'],0,3) == 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://urbanoalvarez.es'.$_SERVER['REQUEST_URI']); } ?>
Remember to change "urbanoalvarez.es" with your domain name.
Other ways
If you don't have php or the module mod_rewirte installed, you could do a simple 301 redirection.
If you don't understand it, or you find a better way of achieving this, please comment
| Print article | This entry was posted by alex on April 7, 2008 at 5:01 pm, and is filed under PHP, Programming, SEO, Web-related. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
No trackbacks yet.
Event tracking – Google Analytics
about 8 months ago - No comments
Hello everyone,
As most people do, I’m sure you use Google Analytics for the stat metrics for some of your sites, so you’ll love this new feature:
If you use AJAX in your site, or if you want to track outbound links, or downloads… etc then this is really useful for you.
What is event tracking?
In simple terms, More >
Measuring the quality of your blog
about 1 year ago - No comments
Although there are a lot of online resources to measure the wuality of your blog, like Blog Juice, Website grader (The bottom of the resports is dedicated to blog) and others like Technorati Authority, all of this services focus on popularity and sometimes SEO aspects.
Taking into account that all a blog is about is people More >
Windows Live users being a bit weird…
about 1 year ago - 3 comments
I use for my blog statistics both StatPress and Google Analytics, since both offer different things, and I was checking my referrers to see what do people search to get to my blog, to optimize my text and keywords to rank higher for those keywords, when I found a very strange thing:
Google users usually use More >
Optimizing your landing page
about 1 year ago - 4 comments
There is no need for me to prove to you that an optimization in your website’s landing page will improve your Return on Investment (ROI) and your Rate of Return (ROR). As a matter of fact it is probably one of the hardest, most over-looked, and most important parts of SEO for a website. It More >
Google AJAX search API
about 1 year ago - No comments
Discover a great way to embed really customized searches in your site, use the Google search API (Using AJAX)
Here I’ll show you how to develop a simple “Hello world” sort of program, using the Google API and AJAX to search.
There are 2 requirements though you need to fulfill in order to access the API:
Your web More >
The secret behind Google’s success
about 1 year ago - 4 comments
Group of research finds out why Google has achieved such a level of popularity. Precisely his advertising tool “Google Adsense”.
Apparently Google “blackmails” all the websites out there with a medium popularity so that they’ll use their ad program. Whenever it finds a website running another advertising program they’ll set their PR to 0.
And this More >
In/Famous Google searches
about 1 year ago - No comments
Google has recently made public their listings of the most popular things on the net in 2007, and I’ve decided to put it up here:
In general:
The terms that were searched suddenly a lot: (Fastest gainers)
News and media:
Most searched-for candidates:
Most searched for rumors (RIP):
RIP (or rumors of)
anna nicole smith
travis barker*
vince mcmahon*
chris benoit
fidel castro*
michael jackson*
ryan sheckler*
bob barker*
criss More >
Writing a good robots.txt file | SEO Tips
about 1 year ago - No comments
Search Bots, crawl each URL and the first thing they search on an URL root is the robots.txt file. So if we make our robots.txt file, we can change the Search Bots’ behaviours, and we can tell them where to search and publish and where to not. Imagine we have privacy folders in our website, More >
DMOZ Submission Guide:
about 1 year ago - 1 comment
As an editor of the DMOZ Directory, I’ve realized what are the most important thing to be taken into account by web masters submitting their work:
Make sure you submit to the most appropriate category. This is very important, as it will decide whether your site is updated into the directory or not. If a site More >
SEO Tool: Search Engine position checker
about 1 year ago - 2 comments
I’ve just finished developing a stable release of quite an advanced SEO tool, I called it “position checker”.
What it does is it crawls the selected search engines upon a list of given queries, and it tries to find matches with your site. If it finds them it tells you on which page and where was More >
about 1 year ago
The link to Google Webmaster Tools is broken.
about 1 year ago
@escritor:
Corrected
Thanks for the tip
about 1 year ago