This post will cover a couple key features and what code we used to dynamically change our .php extensions to read .html while keeping the same filename so there is no need to rename files. This is very easy process and takes a couple easy to follow steps, we'll start out with some of the benefits of using this mod and then give you a breakdown of server settings you will want to check before you get started.
Benefits of rewriting your URL
Plain and simple, easier to read, the search engines will like your pages better and you can hide what language your website it coded in. A good example is 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.
Required for URL rewriting
Directions and examples
After you have checked to make sure your server supports all the the requirements you will need to create a file called .htaccess in the root of your website, this can easily be done on the ftp side of the site. If you use windows you might have an issue creating a .htaccess file due to the fact that microsoft hates linux and knows you're trying to create a file of the sort. Creating it server side via ftp then downloading the file to your desktop might be the best route if you are having issues creating the file. After you create the file add the following code to your .htaccess file:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*).html$ $1.php [nc]
The above example will rewrite the test.php to test.html i.e when a URL like http://localhost/test.html is called in address bar it calls the file test.php. As you can see the regular expression in the 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
RewriteEngine on
RewriteRule ^product-([0-9]+).html$ products.php?id=$1
The above example will rewrite the product.php?id=5 to product-5.html i.e when a URL like http://localhost/product-5.html calls product.php?id=5 automatically.
Good fill someone in on and this post helped me alot in my college assignment. Thanks you as your information.
reply
Very well written blog i enjoy reading this site!
reply
That is nice to definitely find a site where the blogger knows what they are talking about.
reply
Amiable brief and this post helped me alot in my college assignement. Gratefulness you for your information.
reply
Our main place of business and mailing address: