Rouji / single_php_filehost

Simple Filehosting Page in a Single PHP File (obvious 0x0 clone)
ISC License
235 stars 35 forks source link

Apache Directory #17

Closed Hansat1 closed 2 years ago

Hansat1 commented 2 years ago

Hey, I am trying to add to the Apache Directory a site but I can't get it right working. I tried it like that. <Directory C:\xampp\htdocs> Options +FollowSymLinks -MultiViews -Indexes AddDefaultCharset UTF-8 AllowOverride None

RewriteEngine On
RewriteCond "%{ENV:REDIRECT_STATUS}" "^$"
RewriteRule "^/?$" "index.php" [L,END]
RewriteRule "^/?$" "takedown.php" [L,END]
RewriteRule "^(.+)$" "files/$1" [L,END]

<Directory C:\xampp\htdocs\files> Options -ExecCGI php_flag engine off SetHandler None AddType text/plain .php .php5 .html .htm .cpp .c .h .sh I i try accessing the link it only redirects it to a 404 Page

Rouji commented 2 years ago

Could you fix your coypasted code there? Can't really tell what you're doing wrong otherwise.

Hansat1 commented 2 years ago

The links worked before I added the Directory in the apache httpd.conf file. echo <<<EOT <!DOCTYPE html>

Fileron

Fileron




EOT;

Rouji commented 2 years ago

What.

...are you having problems with /takedown.php etc. not working? Is that what you're asking?

Hansat1 commented 2 years ago

My problem is after adding the Directory Text to the XAMPP httpd.conf file the links on the website no longer works and without it they work again

Rouji commented 2 years ago

You're doing the RewriteRule wrong. You're matching ^/?$ twice, meaning second one is always ignored. (And is also incorrect for what you're trying to do)

Here's a working example:

        RewriteCond "%{ENV:REDIRECT_STATUS}" "^$"
        RewriteRule "^/?favicon.ico$" "favicon.ico" [L,END]
        RewriteRule "^/?robots.txt$" "robots.txt" [L,END]
        RewriteRule "^/?$" "index.php" [L,END]
        RewriteRule "^(.+)$" "files/$1" [L,END]
Hansat1 commented 2 years ago

What woud be correct for what i am trying to do?

Rouji commented 2 years ago

I even gave you an example. Please use your own head. If you can't even figure that out, you're frankly not ready to host a public filesharing site.