dimanche 25 décembre 2016

use declared variable in .htaccess for redirecting using ErrorDocument

I tried using this code and it works but the problem is that instead of redirecting to the page (/index.php) it is displaying the string of the base_path value ("/index.php")

# Rewrite Rules
RewriteEngine on
RewriteBase /

# Declare Environments
SetEnvIf Request_URI "^.*" base_path=/index.php

# Prevent Directory Listing
Options -Indexes

# Page Redirection
# Error 400 - Bad Request
ErrorDocument 400 %{ENV:base_path}
# Error 401 - Authorization Required
ErrorDocument 401 %{ENV:base_path}
# Error 403 - Forbidden
ErrorDocument 403 %{ENV:base_path}
# Error 404 - Internal Server Error
ErrorDocument 404 %{ENV:base_path}
# Error 500 - Wrong Page
ErrorDocument 500 %{ENV:base_path}

# Protect Files
<Files configuration.ini>
    Order allow,deny
    Deny from all
</Files>




Aucun commentaire:

Enregistrer un commentaire