I decided to describe how to perform a good URL rewrite, a fundamental aspect in SEO (or SEO ).
First, this tutorial is for servers hosted under APACHE, with the "mod_rewrite" enabled.
1. What is URL rewriting?
This is the way we access the target page (the one we want to reach when we click on a hypertext link).
Let me explain, the pages of dynamic websites are manufactured by the back-end language (in PHP , JAVA or other) located on the remote server and generate the rendering HTML in the browser, on the client's desktop (yours).
Here is an example of a URL that displays a dynamic web page:
Using rewriting, we can access the page via this URL (as if the page was static - not generated on the fly):
This method allows both the user to have a simple URL (known as " user-friendly ") and easily interpretable, but also to the search engines to better Interpret (at the keyword level) and thus categorize them effectively.
This method is very much practiced for SEO (Search Engine Optimization).
2. How to make good URL rewriting?
Under APACHE, you must place an .htaccess file at the root of the server (or the virtual host hosting your website), and the APACHE module "mod_rewrite".
Here is an example of source code:
Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule ^developpement-site-internet-intranet.html$ app.php?page=service&category=web-development [L]
3. When to perform a URL rewrite?
There are several possible cases:
– When redesigning a website , to win natural referencing or mastering the transition between old URLs already indexed in search engines and new accesses. In general, it is very important not to keep URLs pointing to pages not found ("HTTP 404 - Not found", since they no longer exist on the server, but are still indexed in Google) on Your site, so as not to lose information.
For example, if you want to redirect an old URL that is indexed in Google:
You can use the following method:
RewriteRule ^contact.php$ contactez-nous.html [L,R=310]
For example, if you want to delete a URL (term) from the search engine index, you can do the following:
RewriteRule ^url-a-supprimer.php$ http://weenesta.com/ [L,R=410]
– It is always better to think SEO from the beginning of the technical study prior to the website creation, in order to allow to think well the accesses, but also To optimize other points (such as the weight of images, internal or external links - "net-linking", the information contained in the page header (metas "keywords" and "description "), But also the content itself (via appropriate texts or enriched data -" metadata").
There are many other techniques to effectively manage SEO. They may be the subject of a new post.