.htaccess File
The .htaccess
file is a configuration file used by web servers to control site behavior such as redirects. With Modern Campus Hosting, you'll see a file named .htaccess
in your site’s home (root) folder. When you add simple, one-line directives to the file they apply to that folder and all its subfolders.
To get started, set file access to Administrators Only and Publish to Production to No. Then,
- Click to open the
.htaccess
file. - Add directives, with comments.
- See the next section for sample directives you can use.
- Save.
- Publish.
If you encounter an error after publishing, you can use page versions to restore a previous version.
Inside the FileLink to this section
Use redirects and error pages to improve your website user's experience.
Redirects
To set up a temporary (302) or permanent (301) redirect, use one of the following example directives to your .htaccess
file, placing each on its own line:
# Basic permanent redirect
Redirect 301 /old-page.html /new-page.html
# Basic temporary redirect
Redirect 302 /old-page.html /new-page.html
File Comments
To add a comment to the .htaccess
file, start the line with #
.
Need Help?Link to this section
Contact our CMS Support team via the Support Resource Portal (login required) to receive help with managing your .htaccess
file.