Announcement

Collapse
No announcement yet.

Direct access to specific directory .htaccess

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Direct access to specific directory .htaccess

    Hi everyone,

    I need to have direct access to the uploaded images folder located at /data/upload directory. Basically to be able to synchronize and copy some images.

    It seems that the .htaccess file is blocking it (requires a login when trying to access directly)

    I have tried to remove the RewriteRule ^/?data/ - [F] from the .htaccess file but no luck.

    I am a little newbie here and do know how to do it. Any Help?

    EspoCRM 8.1.1

    Thanks,

    Nuno

    _____________________________

    <ifModule mod_headers.c>
    Header always set Access-Control-Allow-Methods "POST, GET, PUT, PATCH, DELETE"
    </ifModule>

    DirectoryIndex index.php

    Options -Indexes

    <IfModule mod_rewrite.c>
    RewriteEngine On

    # Forbid access to other directories for security.
    RewriteRule ^/?data/ - [F]
    RewriteRule ^/?application/ - [F]
    RewriteRule ^/?custom/ - [F]
    RewriteRule ^/?vendor/ - [F]
    RewriteRule /?web\.config - [F]

    # Forbid access to the `public` directory.
    RewriteCond %{ENV:REDIRECT_STATUS} !=200
    RewriteRule ^/?public/? - [F,L]

    # Skip redirect for the `client` directory.
    RewriteRule ^client/ - [L]

    # Store base path.
    RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
    RewriteRule ^(.*)$ - [E=BASE:%1]

    # Add trailing slash.
    RewriteCond %{DOCUMENT_ROOT}/%{ENV:BASE}/public/$1 -d
    RewriteRule ^(.*?[^/])$ %{REQUEST_URI}/ [L,R=301,NE]

    # Rewrite to `public` directory.
    RewriteRule ^((?!public/).*)$ %{ENV:BASE}/public/$1 [L,NC]

    RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}]
    </IfModule>​

  • #2
    Sorry guys, it's working by, or removing the RewriteRule ^/?data/ - [F] from the .htaccess or changing it to RewriteRule ^/?data/ - [L]

    It was a browser cache problem.

    To list the files inside the directory, just create an .htaccess file with Options +Indexes

    Nuno

    Comment

    Working...
    X