Apache + Dir Alias + htaccess and virtualhost _default_: 443 (localhost vs IP Public)

0

I can not enter a directory, which in Apache 2.4 is set as alias, for that vhost , since having a htaccess , which redirects everything to an index.php file, does not take the priority of the alias and passes the path to the index.php. instead of taking the alias as a priority, the route should be an example.

URL Files alias

192.168.1.1:111/facturtas/dsdsdsdsdsdsds.pdf
192.168.1.1:111/facturtas/*.pdf

My htaccess:

Options +FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

And the strange thing is that if I go in as link , there's no problem.

But if I go with a public IP example link , pass it to the index .php instead of downloading the pdf as it does with localhost.

This is for Public IP, port 111 = > NAT < = > private ip port 443 everything works perfect, but the problem is with the delivery of PDFs that are in an alias when it is called from the internet, not PDFs, it falls in the index.php, it is as if internet does not exist the alias, but in localhost

<VirtualHost _default_:443>
#   General setup for the virtual host
DocumentRoot "C:/www/api/www/webroot"
ServerName localhost:443
ServerAdmin admin@localhost
ErrorLog "C:/xampp/apache/logs/error.log"
TransferLog "C:/xampp/apache/logs/access.log"

Alias "/facturas" "//VBOXSVR/Fac"
<Directory "//VBOXSVR/Fac">

    LimitRequestBody 512000

    #Options Indexes FollowSymLinks Includes ExecCGI
    Options -FollowSymLinks -Indexes -Includes -ExecCGI -SymLinksifOwnerMatch -MultiViews
    #Options none

    AllowOverride All
    Require all granted
</Directory>

.....
.....

</VirtualHost>
    
asked by Sergio 29.12.2017 в 22:57
source

1 answer

1

The solution to the problem was in the apache configuration of the vhost

Remove from my <VirtualHost _default_:443> ... </virtualhost> the alias and directory rules and add them outside the <VirtualHost> and everything worked correctly with localhost and the ip posts to the internet.

Alias "/facturas" "//VBOXSVR/Fac"
<Directory "//VBOXSVR/Fac">
        LimitRequestBody 512000
        Options -FollowSymLinks -Indexes -Includes -ExecCGI -SymLinksifOwnerMatch -MultiViews
        AllowOverride All
        Require all granted
</Directory>

<VirtualHost _default_:443>
   #   General setup for the virtual host
   DocumentRoot "C:/www/api/www/webroot"
   ServerName localhost:443
   ServerAdmin admin@localhost
   ErrorLog "C:/xampp/apache/logs/error.log"
   TransferLog "C:/xampp/apache/logs/access.log"
   .....
   .....
</VirtualHost>

I hope that my problem will be useful to others.

    
answered by 30.12.2017 / 00:27
source