(As we know file.htacces are in the main file manager to display the entire blog. Precisely in the folder "public_html")
1. Modified URLs with mod_rewriteIf friends want to change the dynamic URLs like www.123.com/product.php?id=abc become more static URL & user friendly as www.123.com/product/abc. Then the following script on Htaccess:
RewriteEngine on
RewriteRule ^ product /([^/ \ .]+)/?$ product.php? Id = $ 1 [L]
2. Outsmart the query stringOther websites can be put up links that point to a website friendly by adding frills query string. For example www.123.com/index.php?source=abc.com. Query strings can create duplicate content issues on the website that a friend can harm SEO efforts companions. To outsmart, friends can add the following line of code. Htaccess:
RewriteCond% {QUERY_STRING} ^ source = RewriteRule (.*) / $ 1? [R = 301, L]
3. Convert HTML to PHP executable fileIf a friend has a static HTML website. But what if one day a friend wanted to run PHP code on the HTML page? Companions can add the following line of code:
AddHandler application / x-httpd-php. Html
4. Change error pageCompanions can change the error page you want to appear on the visitors who visited the invalid links on a Web / Blog friends. How, first please upload the file 404.php into the public_html directory. Then set the default error pages by adding the following line of code. Htaccess you:
ErrorDocument 404 http://www.abc.com/404.php
5. Redirect pageOne more function of other htaccess redirect (redirect) a page to another page. For example if you want lama.php directed to baru.php. Companions can add the following line of code:
redirect 301 / lama.php http://www.123.com/baru.php
6. Turning off directory listingsDisplaying directory listings on the website could be one of the problems security / security that must be considered. For any files that exist on the web / blog friends can be known to others with ease. Well, following a line of code can disable directory listing on your web / blog friends:
Options-Indexes
7. Hide certain file types from the directory listingOr if a friend decided to keep their directory listings active friend, the friend can hide certain file types to be hidden from directory listings.
IndexIgnore *. gif *. zip *. txt
8. CanonicalizationThe most common htaccess trick is to know whether your website home page has a canonicalization problem or not. Canonicalization is a website that his home page has a number of different URL formats. For example:www.123.com, 123.com, www.123.com/index.html, 123.com/index.html.
Canonicalization is not good for SEO on a website / blog for traffic headed home page counted as a different URL, even though the same content. You can overcome caninicalization by adding the following script in the file. Htaccess you. The following script will force the various formats your URL to format www.abc.com:
Options + FollowSymLinks
RewriteEngine on
RewriteCond% {HTTP_HOST} ^ abc.com
RewriteRule (.*) http://www.abc.com/ $ 1 [R = 301, L]
RewriteCond% {THE_REQUEST} ^ [AZ] {3.9} \ / index \. Html \ HTTP /
RewriteRule ^ index \. Html $ http://www.abc.com/ [R = 301, L]
That's all the article above that I can share to friends, if you want to know more about modifying and the role of. Htacces friend can search for articles through google.