You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mahmood Naderan <nt...@yahoo.com.INVALID> on 2018/12/21 08:57:54 UTC

[users@httpd] Viewing the content of a file without extension in the URL

Hi
Using Apache and Centos 7, I have put two specific files in `/var/www/html` as below


    [root@sn acme-challenge]# pwd
    /var/www/html/.well-known/acme-challenge
    [root@sn acme-challenge]# ls -l
    total 8
    -rw-r--r--. 1 root root 88 Dec 21 12:19 8KyeoB4HPzOPR6Et9uBPWoldME6LGIBV3ps
    -rw-r--r--. 1 root root  2 Dec 21 12:20 test.txt
    [root@sn acme-challenge]# cat 8KyeoB4HPzOPR6Et9uBPWoldME6LGIBV3ps
    8KyeoB4HPzOPR6Et9uBPWoldME6LGIBV3ps.QTHp9d8EEr94A5QohL1LAlh51l9Wsy4ET1jo
    [root@sn acme-challenge]# cat test.txt
    uu


When I enter `https://somewhere.com/.well-known/acme-challenge/test.txt`, the content of the file is shown which is `uu`. 


However, when I enter `https://somewhere.com/.well-known/acme-challenge/8KyeoB4HPzOPR6Et9uBPWoldME6LGIBV3ps`, it is redirected to the main site which is `https://somewhere.com`.





The content of `/var/www/html/.htaccess` is


    Options +FollowSymLinks
    RewriteEngine On

    AddEncoding gzip .gz
    AddEncoding gzip .gzip
    <FilesMatch "\.(js.gz|js.gzip)$">
      ForceType text/javascript
    </FilesMatch>
    <FilesMatch "\.(css.gz|css.gzip)$">
      ForceType text/css
    </FilesMatch>

    <Files CHANGELOG.txt>
    deny from all
    </Files>
    <Files INSTALL.txt>
    deny from all
    </Files>
    <Files UPDATE.txt>
    deny from all
    </Files>



    RewriteCond %{REQUEST_URI} !^/index\.php
    RewriteCond %{REQUEST_URI} !/ow_updates/index\.php
    RewriteCond %{REQUEST_URI} !/ow_updates/classes
    RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
    RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
    RewriteCond %{REQUEST_URI} !/e500\.php
    RewriteCond %{REQUEST_URI} !/captcha\.php
    #RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
    RewriteCond %{REQUEST_FILENAME} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
    RewriteRule (.*) index.php




How can I fix that so that I can view the content of `8KyeoB4HPzOPR6Et9uBPWoldME6LGIBV3ps`?



Regards,
Mahmood

Re: [users@httpd] Viewing the content of a file without extension in the URL

Posted by Yann Ylavic <yl...@gmail.com>.
Hi,

On Fri, Dec 21, 2018 at 9:58 AM Mahmood Naderan
<nt...@yahoo.com.invalid> wrote:
>
>     RewriteCond %{REQUEST_URI} !^/index\.php

RewriteCond %{REQUEST_URI} !^\.well-known/acme-challenge/

>     RewriteCond %{REQUEST_URI} !/ow_updates/index\.php
>     RewriteCond %{REQUEST_URI} !/ow_updates/classes
>     RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
>     RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
>     RewriteCond %{REQUEST_URI} !/e500\.php
>     RewriteCond %{REQUEST_URI} !/captcha\.php
>     #RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
>     RewriteCond %{REQUEST_FILENAME} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
>     RewriteRule (.*) index.php
>
> How can I fix that so that I can view the content of `8KyeoB4HPzOPR6Et9uBPWoldME6LGIBV3ps`?

Adding the RewriteCond where proposed above should work, hopefully.

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org