Tag Archives: htaccess
You can use the .htaccess file to redirect visitors to different files, either on the same website, or on a different site.
Redirect rules are written as below, starting with Redirect, then the location you are directing away from, then the location you are redirecting to.
Redirect /oldindex.php /newindex.php
You can redirect whole directories as well.
Redirect /olddirectory /newdirectory
And you can redirect to a different site.
Redirect /index.php http://othersite.com/newindex.php
Instead of allowing a generic error page to be shown when a visitor has a problem on your website, you can create custom error pages.
These can be more user friendly than the normal pages, and you can try offering your visitors different ways to recover from whatever error they may have encountered.
The pages listed below are the most common ones that will need to be dealt with, but you can create custom pages for many other errors.
Each line must start with ErrorDocument, followed by the code for the error you want to provide a page for, finished with the address of the custom page.
ErrorDocument 401 /errors/unauthorized.php
ErrorDocument 403 /errors/forbidden.php
ErrorDocument 404 /errors/notfound.php
ErrorDocument 408 /errors/timeout.php
ErrorDocument 500 /errors/internalerror.php
Directory indexing loads a given page when a directory is accessed on your website without any other page being specified.
You can also specify a list of pages, which are looked for in the order they are given.
DirectoryIndex index.php index.html