.htaccess & URL Rewrites

How to see if Mod_Rewrite is enabled on site/server

By the Domain India teamPublished 5 min read
Knowledge base article
Contents (4 sections)

On Domain India's Linux shared hosting (cPanel, DirectAdmin and Webuzo), mod_rewrite is already loaded on every server and .htaccess rules are allowed, so there is nothing to switch on. If you want to see it working on your own site, the quickest proof is a two-line test rule, shown below.

For the full guide, see How can I enable the mod_rewrite module

Where .htaccess lives, the common rules (HTTPS, www, clean URLs, WordPress and Laravel), testing, and fixing 500 errors and redirect loops are all covered in how to enable and use mod_rewrite.

Key takeaways

mod_rewrite is loaded on Domain India's cPanel, DirectAdmin and Webuzo servers (checked 22 September 2026). To prove it on your site, create a test folder with a tiny rewrite rule and open the rewritten address: if you see the test text, rewriting works. Don't rely on phpinfo() or apache_get_modules(): phpinfo() is disabled on our cPanel servers, and apache_get_modules() doesn't exist when PHP runs through PHP-FPM or CGI, as it does on our servers.

1. The reliable check: a harmless test rule

This test proves more than "the module is installed". It proves that Apache reads your .htaccess file and applies rewrite rules in your folder.

  1. Create a test folder.
    In your file manager, inside your website folder (usually public_html), create a folder called rewrite-test.
  2. Add a text file.
    Inside it, create pong.txt containing the words mod_rewrite works.
  3. Add the rule.
    In the same folder, create a file named .htaccess with the two lines shown below.
  4. Open the test address.
    Visit https://yourdomain.in/rewrite-test/ping in your browser. There is no file called ping, so the only way you can see the text is through the rule.
  5. Delete the folder
    once you have your answer.
apache
RewriteEngine On
RewriteRule ^ping$ pong.txt [L]

What the result means:

You seeMeaningWhat to do
The words "mod_rewrite works"mod_rewrite is on and your .htaccess rules runNothing: you are ready to write rules
404 Not FoundThe rule was not appliedCheck the file is named exactly .htaccess (not .htaccess.txt) and sits inside rewrite-test
500 Internal Server ErrorApache could not read a line in the fileCheck for typos or curly quotes, then read your error log
Testing on cPanel

Our cPanel servers have a caching proxy in front of Apache that can serve a stored copy of a page for up to two hours. A brand-new address like /rewrite-test/ping is not cached, so this test is reliable. If you re-test after an edit, add a query string such as ?t=2.

2. Why phpinfo() and apache_get_modules() won't tell you

Many older guides suggest a PHP page that lists Apache modules. On our shared hosting neither method works:

  • phpinfo() doesn't show Apache's modules here. It is switched off for some sites, and where it does run, PHP runs outside Apache (through PHP-FPM or CGI), so there is no "Loaded Modules" line to read.
  • apache_get_modules() doesn't exist here. That function is available only when PHP runs inside Apache as a module. On our Linux shared servers PHP runs separately, through PHP-FPM or CGI, so calling it stops the script with a "Call to undefined function" error. That error says nothing about mod_rewrite.

3. Other quick signs that rewriting works

  • WordPress: if your posts open at pretty addresses such as /my-first-post/ rather than /?p=123, WordPress's rewrite rules are running. If they return "Not Found", open Settings, then Permalinks, and click Save to rewrite the .htaccess block.
  • Windows (Plesk) hosting runs IIS, which does not use mod_rewrite or .htaccess. Rules there go in web.config: see section 9 of the mod_rewrite guide.

If the test gives a 500 error and you can't find the cause, reviewing error logs in cPanel and DirectAdmin shows where Apache records the exact line it rejected.

Frequently asked questions

Is mod_rewrite enabled on Domain India hosting?

Yes. mod_rewrite is loaded on Domain India's cPanel, DirectAdmin and Webuzo shared servers and .htaccess files are allowed, so customers don't need to enable it. Windows (Plesk) hosting uses IIS and web.config instead.

How can I check if mod_rewrite is working on my site?

Create a folder called rewrite-test with a file pong.txt and an .htaccess file containing RewriteEngine On and RewriteRule ^ping$ pong.txt [L]. Open yourdomain/rewrite-test/ping: if the text from pong.txt appears, rewriting works. Delete the folder afterwards.

Can I use phpinfo() to see if mod_rewrite is loaded?

Not on Domain India's cPanel servers, where phpinfo() is disabled. Use a test rewrite rule instead: it shows whether your rules actually run.

Why does apache_get_modules() give an undefined function error?

The function exists only when PHP runs inside Apache as a module. On Domain India's Linux shared hosting PHP runs through PHP-FPM or CGI, so the function is not available. The error does not mean mod_rewrite is missing.

My test shows 404 Not Found. Is mod_rewrite off?

No, a missing module would cause a 500 error, not a 404. A 404 usually means the .htaccess file has the wrong name, such as .htaccess.txt, or is in a different folder from pong.txt.

Ready to write real rules? The mod_rewrite guide has HTTPS, www, clean-URL and WordPress examples, and the non-www to www guide covers canonical redirects in depth. If your test fails and you can't see why, open a support ticket with your domain and what the test showed.

Hosting where .htaccess rules just work

Apache with mod_rewrite loaded, free SSL and a file manager on every Linux shared plan.

See cPanel hosting plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
Check if mod_rewrite Is Enabled on Your Site | Domain India