# 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.

Source: https://www.kualo.com/knowledgebase/cpanel-php/how-can-i-enable-modrewrite
Updated: 2026-06-09

---

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](https://www.litespeedtech.com/) 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.
- `.htaccess` files 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

1. Open **cPanel** and go to **File Manager**, or connect via FTP.
2. Navigate to the folder where you want the rules to apply - usually your site's root directory (`public_html`).
3. Open or create a file called `.htaccess` in that folder.
4. Add `RewriteEngine On` as the first line, followed by your rewrite rules.
5. Save the file.

:::warning
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

```apache
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:

1. Log in to your WordPress dashboard.
2. Go to **Settings > Permalinks**.
3. 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](/knowledgebase/wp-troubleshooting/how-to-diagnose-and-fix-404-errors-on-wordpress-permalinks-htaccess-and-missing-files).


## Troubleshooting

If your rewrite rules are not working as expected:

- Make sure `RewriteEngine On` appears before any `RewriteRule` or `RewriteCond` directives.
- Check that the `.htaccess` file 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](/knowledgebase/wp-troubleshooting/how-to-fix-a-500-internal-server-error-on-your-website).
- If you are using LiteSpeed Cache, purge the cache and test again.
- For a broader guide to diagnosing `.htaccess` problems, see [Troubleshooting .htaccess issues](/knowledgebase/dev-server/troubleshooting-htaccess-issues).

If you are still stuck after working through the above, [contact our support team](/knowledgebase/getting-started/how-to-create-a-support-ticket-in-mykualo) and we will be happy to help.

## Further reading

The official [Apache mod_rewrite documentation](https://httpd.apache.org/docs/current/mod/mod_rewrite.html) 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.

---

_Source: Kualo Knowledgebase — https://www.kualo.com/knowledgebase/cpanel-php/how-can-i-enable-modrewrite · © Kualo Ltd._
