What is mod_rewrite and can it be used on 20i hosting?
What is Mod-Rewrite?
Mod-rewrite is an Apache module used for the purpose of rewriting URLs. mod-rewrite is implemented via specific rules added to the .htaccess file.
The purpose of the rules is to control how URLs are displayed or alternatively how incoming requests get processed by the server.
What are the purposes of Mod-Rewrite?
There are different ways of manipulating URLs via Mod-Rewrite these include:
URL Redirection: used for redirecting one URL to another for example a common use of this is redirecting HTTP requests to HTTPS.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %(HTTPS) !=on
RewriteRule ^ https://%(HTTP_HOST)%(REQUEST_URI) [L,R=301]
</IfModule>
URL Rewriting: URLs can be rewritten dynamically based on certain conditions using regular expressions. Examples of this include making URLs more user-friendly and easy to remember, also rewriting URLs can result in better SEO results.
example.com/product.php?id=123
to a more user-friendly version:
example.com/product/123
URL Blocking/Filtering: URLs can also be blocked or filtered based on Mod-rewrite rules added to the .htaccess. This can be useful for blocking malicious requests to the site or restricting access to certain website areas.
Is Mod-Rewrite enabled on 20i?
Mod-rewrite is enabled by default on the 20i platform, meaning whether, your site is on Windows, Linux or WordPress you can make use of Mod-rewrite.
The only limitation to Mod-rewrite on the 20I shared hosting platform is that Mod-rewrite can't be used to rewrite any URLs within the uploads folder of a WordPress site due to security rules implemented.