Freelance Web Developer
: Available for hire to work on projects of all sizes and types. Get in touch for a quote.
Permanent redirects are an important tool not only for general PHP development but also for Search Engine Optimisation. To a general user the browser simply forwards on to the new URL, probably without you even noticing. To search engine crawlers they are also forwarded but provided extra information that the page they are visiting has permanently moved to the new address. If this was Google for example, Googlebot would notice the change and drop the old URL from it’s index and begin indexing the new one.
So, what’s the point in a 301 permanent redirect and how does it differ to a standard redirect? If you needed to change the way a URL is structured from, for example, index.php?page=1 (very non-SEO friendly) to /web-development-gloucestershire/ (SEO friendly) then you can inform search engines of the change. Without the permanent redirect the first page will either fail and produce a ’404 Not Found’ or be identical to the new page – thus causing duplicate content issues.
The permanent redirect differs from a standard redirect because of the way it is informing search engines of the change. Without this it would become a temporary redirect or standard redirect. This means that search engines will keep the original page in it’s index because it is expecting the redirect to be removed at some point soon.
To create a 301 permanent redirect in PHP you use the following two lines of code, it’s really that easy.
<?php header('HTTP/1.1 301 Moved Permanently'); header('http://rosstanner.co.uk/'); ?>
Remember, this must be placed at the very top of the script. More specifically, before any HTML content or output is produced. This is because PHP uses the headers, which are called before any output, in order to complete the redirect.
Is there a limit on how many 301 redirects I can use on my website?
In short the answer is no, there isn’t a limit. However there is a limit on ‘chained redirects’ as Matt Cutts from Google explains.
If you are running an Apache server you can achieve this using .htaccess too. If you don’t have access to edit this file within your online files then consult your webmaster.
Tagsaggregator codeigniter computer css database developer development email facebook fifa fifa 12 football framework freelance google googlebot html iPad jquery linux membership system Motherboard mysql myvouchercodes open source php php tutorial resources rossytzoltan rss search engine optimisation seo social media tech forum the guardian tutengine tutorial tutorial search engine tweet twitter ubuntu user system web developer web developer twitter zend
PHP Freelance Web DeveloperMy primary skills as a freelance web developer include: