Convert .htaccess
Turn the .htaccess file from an Apache host into web server rules and redirects for a site.
Before you start
- You can open the site in Managed Websites. Anyone who can open a site can convert a file and save the result.
- You have the
.htaccessfile from your old host, up to 256 KB. Convert a larger file in parts.
Convert the file
Open the converter
Go to Managed Websites, choose the site, then Web server rules under Site settings. Choose Convert an .htaccess…, or on a site that already has rules, open the section's … menu and choose Convert .htaccess….
Paste the file
Paste the file into Paste the .htaccess, or upload it, then choose Convert.
Review the result
The summary line counts what was found. Open each group to read it.
Put the rules in the editor and save
Choose Insert into editor. The rules are added unsaved: check them, then test and save them as in Web server rules.
Nothing on the site changes until you save.
What the groups mean
| Group | What to do |
|---|---|
| Converted | Rules ready for the editor. Insert into editor adds them. |
| Suggested by AI | Rules to review before saving. Insert the suggestions too is ticked: untick it to leave them out. |
| Redirects found | Choose Add redirects (the button counts yours). Redirects opens Import redirects with these lines, ready to parse and import. |
| Needs attention | Lines that could not be converted, each with the reason. |
| Use another setting | Lines that another part of the Control Panel does, such as a PHP setting. |
| Handled by the platform | Lines the site does not need. Nothing to do. |
Each user can run 20 conversions an hour, and a result is kept for an hour. The values of SetEnv lines are never shown or stored.
Automate this
Converts an Apache .htaccess file into Nginx rules per hook, the redirect lines for the site's redirects, and the lines that could not be converted; nothing is saved.
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/nginx-rules/htaccess \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"content": "RewriteEngine On\nRedirect 301 /old-page /new-page\nOptions -Indexes\nHeader set X-Frame-Options SAMEORIGIN\n"
}'Your assistant calls corestack_nginx_htaccess_convert.
{
"name": "corestack_nginx_htaccess_convert",
"arguments": {
"site_id": 4211,
"content": "Redirect 301 /old /new\nRewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteRule ^ index.php [L]\n"
}
}