Modify htacess to allow download of xml files

Asked

Viewed 33 times

-2

I have the following code in my file ". htacess"

RewriteEngine On
#Options All -Indexes

## ROUTER WWW Redirect.
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

## ROUTER HTTPS Redirect
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteCond %{HTTPS} off
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ROUTER URL Rewrite
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ Sistema/index.php?route=/$1 [L,QSA]

But when I click on the button to download an xml file that is in the system directory I get the following message:

Failed opening required 'code/backup.xml' (include_path='C:\xampp_2020\php\pear') in C:\xampp_2020\htdocs\Sistema\index.php

I tried to modify php.ini and it didn’t work, so I think the problem is with my htacess

  • I believe the problem is not in . htacess but in the absolute URL for your backup.xml access. Since you use xampp, it is interesting to create a Gobal variable called $url that receives the address of your application, for example: $url = 'localhost/project/'; and every time you use it just put a $url." code/backup.xml" which will probably find the file.

  • 1

    Talles tested in the application and it worked yes, thank you very much! I had not messed with htaccess before and believed that the problem was in it doing some kind of "blocking" while downloading files from my application

  • I will leave below for documentation order to close your question.

1 answer

0


I believe the problem is not in . htacess but in the absolute URL for your backup.xml access. Since you use xampp, it is interesting to create a Gobal variable called $url that receives the address of your application, example: $url = 'localhost/projeto/'; and every time you use it just put: $url."code/backup.xml" that he’ll probably find the file.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.