On this page
How can I enable mod_rewrite?
URL rewriting lets you turn complex query strings into clean, human-friendly addresses using rules in your .htaccess file. This guide explains how it works on Kualo's LiteSpeed-powered hosting and walks you through setting it up.
URL rewriting lets you transform complex query strings into clean, human-friendly addresses using rules you define. For example, you can turn:
https://www.yourdomain.com/index.php?section=services&product=hosting
into:
https://www.yourdomain.com/services/hosting
This is particularly useful for PHP-driven sites where you want search-engine-friendly URLs in the address bar.
How URL rewriting works on Kualo hosting
All Kualo shared hosting servers run LiteSpeed Web Server rather than Apache. LiteSpeed has full, built-in support for mod_rewrite-compatible rules, so you do not need to install or enable anything at the server level - rewriting works out of the box via your .htaccess file, exactly as it would on Apache.
This means:
RewriteEngine On,RewriteRule,RewriteCond, and all standard mod_rewrite flags work as expected..htaccessfiles are processed by LiteSpeed natively.- You do not need to contact us to enable mod_rewrite - it is already active.
How to add rewrite rules
- Open cPanel and go to File Manager, or connect via FTP.
- Navigate to the folder where you want the rules to apply - usually your site's root directory (
public_html). - Open or create a file called
.htaccessin that folder. - Add
RewriteEngine Onas the first line, followed by your rewrite rules. - Save the file.
Editing .htaccess files can affect your entire site if done incorrectly. Create a copy of your .htaccess file first before making changes so you can restore it quickly if something goes wrong.
Example .htaccess file
RewriteEngine On
RewriteRule ^([^/\.]+)\.htm$ index.php?page=$1 [L]
This example rewrites any request for a .htm page (such as services.htm) to index.php?page=services.
WordPress and pretty permalinks
If you are running WordPress, the rewrite rules that power pretty permalinks (for example /2024/my-post/ instead of /?p=123) are written automatically to your .htaccess file by WordPress itself. You normally do not need to add them by hand.
If your WordPress permalinks stop working - typically showing 404 errors on posts and pages that definitely exist - the most common fix is to re-save your permalink settings:
- Log in to your WordPress dashboard.
- Go to Settings > Permalinks.
- Click Save Changes without changing anything.
This regenerates the .htaccess rewrite block. For a more detailed walkthrough, see How to diagnose and fix 404 errors on WordPress.
Troubleshooting
If your rewrite rules are not working as expected:
- Make sure
RewriteEngine Onappears before anyRewriteRuleorRewriteConddirectives. - Check that the
.htaccessfile is saved in the correct directory - rules only apply to the folder they are in and its subfolders. - Look for syntax errors; a single misplaced character can cause a 500 Internal Server Error.
- If you are using LiteSpeed Cache, purge the cache and test again.
- For a broader guide to diagnosing
.htaccessproblems, see Troubleshooting .htaccess issues.
If you are still stuck after working through the above, contact our support team and we will be happy to help.
Further reading
The official Apache mod_rewrite documentation covers the full syntax, including all available flags and condition directives. Because LiteSpeed is compatible with mod_rewrite, this documentation applies directly to rules you write on Kualo hosting.