All you have to do is add this code into your .htaccess file and save it! Like all file changes, it can take some time before it updates everywhere, but you can speed up the process on your devices simply by clearing your browser’s cache. This code snippet will set custom index pages on your website.
All you have to do is add this code into your .htaccess file and save it! Like all file changes, it can take some time before it updates everywhere, but you can speed up the process on your devices simply by clearing your browser’s cache. This code snippet will redirect all URLs to the https (secure) version of your site!
DirectoryIndex index.php index.html home.html home.php mycustomfile.html mycustomfile.php
You can add as many different filenames as you want, just make sure to separate each with a space.
Note: An .htaccess file located in a sub-directory overrides any duplicate rules from previous .htaccess files. For example, if you have a .htaccess file located in the root defining a 404 and 403 error page, and another .htaccess located in the “test” folder defining only a 404 error page, any files and folders in the “test” folder will use the 404 page defined in the "test" .htaccess file, and the 403 page defined in the root .htaccess file.
Unsure of how to install this code? It's pretty simple. A .htaccess file is called “.htaccess”, with nothing before the dot. Try finding this on your FTP software. Many systems don’t allow filenames starting with a dot (So downloading a htaccess file can be difficult at times), so that also restricts how we can create a .htaccess file. It is possible to get around these restrictions though, so here are the steps!
If you are still confused, or it's not working for you, check out the more detailed instruction in our Finding, Creating, and Editing a .htaccess file article.
Hopefully you were successful in installing this snippet, if you need help, feel free to send us a message! Check out the rest of the htaccess snippets to see what other amazing things you can do!
Setting your error pages is important, so if someone tries to access a page that does not exist, or a page they are forbidden to see, they will get a friendly error message, plus some helpful links fr...
Want to add a trailing slash to every URL on your website? For example, replacing “domain.com/test” with “domain.com/test/”.
Have some amazing content on your website? Since you're here, you probably know what caching is (If you don’t, it’s the fact that your computer saves copies of webpages, so you can view them later wit...
All code and content © 2023. Contact Us to learn more.