Mod_Rewrite – How to Enable It
Mod_Rewrite - How to Enable It
To enable Mod_Rewrite for your site, create a file called .htaccess
in the directory where you want the rewrite rules to apply.
In most cases, this file should be placed in the main domain folder, usually named after your domain. You can create and edit the .htaccess
file using the File Manager tool in your Control Panel:
- Go to Files > File Manager > New File.
- Create the
.htaccess
file and insert the following line:
RewriteEngine On
The second option is to use the advanced .htaccess Generator located in Advanced > .htaccess Generator. Simply enable mod_rewrite in the generator's settings.
Once enabled, add your rewrite rules. Here’s an example for WordPress:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Many applications come with default rewrite rules in a file called htaccess.txt
.
For basic redirects, check out our guide: How to redirect/forward a website.
Tags: .htaccess, Control Panel, enable mod_rewrite, file manager, htaccess.txt, Mod_Rewrite, mod_rewrite rules, rewrite rules, RewriteEngine On, Scripting., URL redirection, WordPress