Can I set up custom error pages for specific HTTP status codes using .htaccess?

Yes, you can set up custom error pages for specific HTTP status codes using `.htaccess`. You can use the `ErrorDocument` directive to achieve this. Here’s how:

ErrorDocument <HTTP_STATUS_CODE> /path/to/custom/error/page

Replace `<HTTP_STATUS_CODE>` with the actual HTTP status code (e.g., 404 for Page Not Found error) and `/path/to/custom/error/page` with the relative or absolute path to your custom error page.

Here’s an example of setting up custom error pages for common HTTP status codes:

ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html

These lines would direct Apache to display the corresponding custom error pages located at `/errors/400.html`, `/errors/401.html`, etc., for the respective HTTP status codes.

Make sure to replace `/errors/400.html`, etc., with the actual paths to your custom error pages.

After adding or modifying these directives in your `.htaccess` file, save the changes, and then test by triggering the respective HTTP status codes to ensure that the custom error pages are displayed as expected.