HostingHosting featuresSpanish version

Support article

Apache mod_rewrite: does it work on our servers

Yes, Apache mod_rewrite works on our servers. Learn what it is for, how to use it and what to review if your friendly URLs do not load.

Published: 23/06/2026Updated: 23/06/2026

Introduction

Yes, Apache mod_rewrite works on our servers.

This Apache module allows you to rewrite or modify your website URLs through rules, usually from a .htaccess file. It is widely used to create friendly URLs, improve website link structure and make indexing easier for search engines such as Google.

For example, with mod_rewrite you can transform a URL like:

yourdomain.com/product.php?id=25

into a clearer and easier-to-remember URL such as:

yourdomain.com/product/shoes

This is especially useful in websites built with CMS platforms, online stores, PHP frameworks or custom developments.

Steps to use Apache mod_rewrite in your hosting

1. Access your website files

Log in to your hosting control panel, whether it is DirectAdmin, cPanel or the panel available with your service, and open the file manager.

You can also connect by FTP if you prefer to manage the files from your own computer.

2. Find or create the .htaccess file

The .htaccess file is normally located inside the main folder of your website, for example:

public_html/

If you do not see it, check that the file manager has the option to show hidden files enabled, since files that begin with a dot may be hidden.

3. Add your rewrite rules

Inside the .htaccess file, you can add rules like this:

RewriteEngine On

RewriteRule ^contact/?$ contact.php [L]

With that rule, a visit to:

yourdomain.com/contact

will internally load the file:

contact.php

4. Save the changes and test the URL

After saving the file, open your website in the browser and confirm that the URL works correctly.

If the browser shows an error, check that the rule is written correctly and that the destination file exists.

5. Verify the rules generated by your CMS

Many content management systems, such as WordPress, PrestaShop and others, automatically generate rules in the .htaccess file.

In those cases, you normally do not need to write the rules manually. You only need to enable friendly URLs or permalinks from the CMS settings.

Basic .htaccess example with mod_rewrite

This is a simple example to enable mod_rewrite and send all requests to an index.php file, which is common in frameworks and PHP applications:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

These rules say that if the requested URL does not match a real file or folder, the request will be sent to index.php.

Useful tips

  • Use friendly URLs whenever possible. Clear URLs are easier to remember, share and understand for both users and search engines.
  • Back up the .htaccess file before editing it. A small rule error can cause your website to show a 500 error. Keeping a copy lets you restore it quickly.
  • Review the rule syntax carefully. mod_rewrite is powerful, but also sensitive to errors. If a rule does not work, check symbols, spaces, paths and conditions.
  • Be careful with infinite redirects. A badly configured rule can make a URL redirect to itself again and again.
  • Combine mod_rewrite with SSL. If you have an active SSL certificate, you can use .htaccess rules to redirect your website automatically from http to https.

Example:

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Frequently asked questions

Is Apache mod_rewrite enabled at miHosting

Yes. Apache mod_rewrite works on our servers, so you can use URL rewrite rules from the .htaccess file.

What is mod_rewrite used for

It is used to change, rewrite or redirect URLs. It is common to use it for friendly URLs, HTTP to HTTPS redirects, duplicate content control or route handling in web applications.

Do I need to enable mod_rewrite manually

No. Under normal conditions, the module is already available on the server. You only need to add the corresponding rules to your .htaccess file or configure friendly URLs inside your web application.

Why is my mod_rewrite rule not working

The most common causes are a badly written rule, a .htaccess file placed in the wrong folder, browser cache, duplicate rules or conflicts with the installed CMS.

Can I use mod_rewrite in WordPress

Yes. WordPress uses rewrite rules in .htaccess to handle its permalinks. If you change the link structure, WordPress can update those rules automatically.

Final recommendations

Apache mod_rewrite is available on our servers and you can use it to create friendly URLs, configure redirects and improve your website structure.

If your website is built with a CMS, review the internal permalink or friendly URL options first. If you manage a custom application, you can add your own rules in the .htaccess file.

If a rule creates errors or your website stops loading, restore the previous version of the file and contact our technical support team. You can also consider website maintenance, professional hosting or VPS if your project needs more advanced settings or greater environment control.