Seo Master present to you:
What are the benefits of rewriting URL?Collected From: http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html When a search engine visits the dynamic url like product.php?id=5 it does not give much importance to that URL as search engine sees "?" sign treat it as a url which keeps on changing. so we're converting the dynamic URL like the product.php?id=5 to static url format like product-5.html. We'll rewrite the url in such a way that in browser's address bar it will display as a product-5.html but it actually calls the file product.php?id=5. So that why these kind of URL also named as SEO friendly URL. What is required for URL rewriting??To rewrite the URL you must have the mod_rewrite module must be loaded in apache server. And furthermore, FollowSymLinks options also need to be enabled otherwise you may encounter 500 Internal Sever Error. How to check weather mod_rewrite module is enabled or not? Well there are lots of techniques to check this but I'll show you a very simple technique to check weather mod_rewrite module is enabled or not in you web server. 1) Type <?php phpinfo(); ?> in a php file and save it and run that file in the server. How to enable mod_rewrite module in apache in xampp, wamp? Now, I'll show you how to enable how to mod_rewrite module in apache installed under windows environment. Examples of url rewriting for seo friendly URL For rewriting the URL, you should create a .htaccess file in the root folder of your web directory. And have to put the following codes as your requirement. Options +FollowSymlinks The following example will rewrite the test.php to test.html i.e when a URL like http://localhost/test.htm is called in address bar it calls the file test.php. As you can see the regular expression in first part of the RewriteRule command and $1 represents the first regular expression of the part of the RewriteRule and [nc] means not case sensitive. Options +FollowSymlinks The following example will rewrite the product.php?id=5 to porduct-5.html i.e when a URL like http://localhost/product-5.html calls product.php?id=5 automatically. Hiding PHP file extension Collected From: http://roshanbh.com.np/2008/01/hiding-php-file-extension.html Do you want to hide your web site's server script identity ? If you don't want to reveal the programming language ( server side script ) of your website to visitors of website so that any hacker or spammer will not be able to intrude or inject any code in your website. Here is a small technique for you, you can use .html or .asp file to work as a php file i.e. use .asp or .html extension instead of .php. You just need to create a .htaccess file and put the following code in the .htaccess file. Remember that the .htaccess file should be placed in the root folder of your website. # Make PHP code look like asp or perl code if you place the the above code in the .htaccess file then you can use contact.asp as the name of the file. Now a visitor thought that it is a ASP file but this file contains the codes of PHP. You can put the following code in .htaccess file to work .htm or .html file as PHP file. # Make all PHP code look like HTML
Redirecting www URL to non www URL Data Collected From: http://www.9lessons.info/2009/01/htaccess-tutorials.html If you type www.twitter.com in browser it will be redirected to twitter.com.
RewriteEngine On
Rewriting 'site.com/profile.php?username=foxscan' to 'site.com/foxscan'
If you want change like this see the below code RewriteEngine On
This time I'm talking about rewriting second parameter URLs using .htaccess file. Collected From: http://www.9lessons.info/2009/11/pretty-urls-with-htaccess-file.html
//First Parameer
|
Labels: