"Ask God" to access any file URL returns any filename to the user to download??????

Source: Internet
Author: User
Tags file url
Access any file URL to return any filename to the user to download??????

Case:

There is actually only one file in the http://down1.020pidai.com/8935/server.

such as 000000.exe

The functions to be realistic are:
User access to any name can download a file of any name, without the occurrence of 404 misplaced file does not exist

Access
Http://down1.020pidai.com/8935/111111.exe
The server returned 111111.exe to the user to download, the user downloaded to see the file name 111111.exe instead of 000000.exe on the server


Http://down1.020pidai.com/8935/222222.exe
The server returns 222222.exe to the user to download, and the user downloads to see the file name 222222.exe instead of 000000.exe on the server


Trouble, Big God.


Reply to discussion (solution)

That is, no matter what the user loses the name, only download 000000.exe this file?

Header ("content-disposition:attachment; Filename=000000.exe ");

That is, no matter what the user loses the name, only download 000000.exe this file?

Header ("content-disposition:attachment; Filename=000000.exe ");

Your code is to access any URL downloaded 000000.exe but the file name received is 000000.exe

That is, no matter what the user loses the name, only download 000000.exe this file?

Header ("content-disposition:attachment; Filename=000000.exe ");

The effect I want is server only 000000.exe a file

User Access Www.url.com/down/111111.exe will save 111111.exe instead of saving 000000.exe

User Access Www.url.com/down/222222.exe will save 222222.exe instead of saving 000000.exe

Use Urlrewrite to hide the entry file name
So the/8935/222222.exe in Http://down1.020pidai.com/8935/222222.exe as the Path_info incoming entry file
And the/8935/222222.exe in the
8935 can represent the actual 000000.exe
222222.exe is the header ("content-disposition:attachment; Filename= $filename "); $filename

Can you understand?

Http://down1.020pidai.com/8935/222222.exe the entrance file name with Urlrewrite
so/8935/222222.exe is Path_info Incoming Portal file
and
8935 in/8935/222222.exe can represent the actual 000000.exe
222222.exe is the header ("Content-disposition:a Ttachment; Filename= $filename "); Can you understand $filename

? The

code writes this??? Looks like the code did not mention to download 000000.exe
!--? php
header ("content-disposition:attachment; Filename= $filename "); $filename
?>

How else can I access this? The above code is saved as exe.php in the root directory www.url.com/exe.php

www.url.com/down/***

Pseudo static rewrite www.url.com/exe.php???

is that so??

Already understand!!

All code

New exe.php
Code:
Header ("content-disposition:attachment; Filename= $filename "); $filename
?>

Create a new. htaccess file
Code:
Rewriteengine on
Rewritebase/
Rewriterule ^index\.php$? L
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewriterule. /index.php [L]


New Catalog 8935
New. htaccess file under directory 8935
The code is as follows:
Rewriteengine on
rewritebase/8935/
Rewriterule ^000000\.exe$? L
Rewriterule. /000000.exe [L]


000000.exe can be placed in catalogue 8935

In this way access to www.url.com/8935/is freely written by the name of. exe
The resulting files are:
Feel free to write the name. exe

Apache can be the IIS Httpd.ini how to do it, can be implemented without

Use Urlrewrite to hide the entry file name
So the/8935/222222.exe in Http://down1.020pidai.com/8935/222222.exe as the Path_info incoming entry file
And the/8935/222222.exe in the
8935 can represent the actual 000000.exe
222222.exe is the header ("content-disposition:attachment; Filename= $filename "); $filename

Can you understand?

Moderator IIS can achieve such an effect, httpd.ini inside

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.