Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.htaccess - how to proxy all .exe files in a dir?

how could i proxy all .exe files?

example:
i visit http://domain.com/file/randomstring.exe

it will proxiy the file http://domain.com/file/1.exe

any way of doing this with htaccess..?
http://corz.org/server/tricks/htaccess.php take a read of this it should help you.
(Oct 27, 2014 04:45 PM)Zasto Wrote:  http://corz.org/server/tricks/htaccess.php take a read of this it should help you.

I can use google myself, thanks.

Haven't found any with the exact thing I am wanting. I am not too good with htaccess lol
(Oct 27, 2014 04:53 PM)'An0ny Wrote:  I can use google myself, thanks.

Haven't found any with the exact thing I am wanting. I am not too good with htaccess lol

Hello An0ny,

I believe the mod_rewrite module is what you are looking for. For documentation take a look here:
http://httpd.apache.org/docs/trunk/rewri...pping.html

Code
RewriteEngine  on
RewriteRule    ^/foo\.html$  /bar.html [PT]

So in your case:
Code
RewriteEngine  on
RewriteRule    ^/randsomstring\.exe$  /1.exe [PT]

You can also use regex to match the file name. For example
Code
RewriteEngine  on
RewriteRule    ^/.*\.exe$  /1.exe [PT]

Should match {anything}.exe and point it towards 1.exe

Hope this helped.

Kind regards
It isn't possible to count the number of files, which I assume is what you want (1,2,3,4,etc.).
.htaccess:
Code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*).exe$ file.php?file=$1 [NC,L]

file.php:
PHP Code

<?PHP
header
("Content-type: application/octet-stream");
if(isset(
$_GET['file']))
{
    if(
$_GET['file']=="xyz")
    {
        
readfile("abc.exe");
    }
}
?>
Put the .htaccess and the file.php into the directory where you keep the exe files and it will work.
You see, Doctor, God didn't kill that little girl. Fate didn't butcher her and destiny didn't feed her to those dogs.
If God saw what any of us did that night he didn't seem to mind. From then on I knew... God doesn't make the world this way.
We do.
(Oct 28, 2014 06:34 AM)Kindfile Wrote:  Hello An0ny,

I believe the mod_rewrite module is what you are looking for. For documentation take a look here:
http://httpd.apache.org/docs/trunk/rewri...pping.html

Code
RewriteEngine  on
RewriteRule    ^/foo\.html$  /bar.html [PT]

So in your case:
Code
RewriteEngine  on
RewriteRule    ^/randsomstring\.exe$  /1.exe [PT]

You can also use regex to match the file name. For example
Code
RewriteEngine  on
RewriteRule    ^/.*\.exe$  /1.exe [PT]

Should match {anything}.exe and point it towards 1.exe

Hope this helped.

Kind regards

Thanks - exactly what I were looking for 🤝


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Dag0bertDuckMar 24, 2024 07:59 PM 4 216 Mar 24, 2024 07:59 PM
Last Post: memory
by MankOct 15, 2020 08:01 AM 4 144 Oct 15, 2020 08:01 AM
Last Post: Dolla$
by codasApr 18, 2020 05:54 AM 4 129 Apr 18, 2020 05:54 AM
Last Post: codas