.

.

Rewrite URL after redirecting 404 / 500 error htaccess


.htaccess is a configuration file for use on web servers running the Apache Web 
Server software. When a .htaccess file is placed in a directory which is in turn 
'loaded via the Apache Web Server', then the .htaccess file is detected and executed
 by the Apache Web Server software. 
These .htaccess files can be used to alter the configuration of the Apache Web Server
 software to enable/disable additional functionality and features that the Apache
 Web Server software has to offer. These facilities include basic redirect 
functionality, for instance if a 404 file not found error occurs, or for more
advanced functions such as content password protection or image hot link prevention.
 
 
ErrorDocument 404 http://example.com/404/
ErrorDocument 500 http://example.com/500/
# or map them to one error document:
# ErrorDocument 404 /pages/errors/error_redirect.php
# ErrorDocument 500 /pages/errors/error_redirect.php

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /pages/errors/404.php [L]

RewriteCond %{REQUEST_URI} ^/500/$
RewriteRule ^(.*)$ /pages/errors/500.php [L]

# or map them to one error document:
#RewriteCond %{REQUEST_URI} ^/404/$ [OR]
#RewriteCond %{REQUEST_URI} ^/500/$
#RewriteRule ^(.*)$ /pages/errors/error_redirect.php [L]

 


EmoticonEmoticon