开发者

How would I redirect a non-php file's URL, without editing the .htaccess file?

So basically I need a way to take an exe file on my server and make a php function to toggle it's availability. I do not want to just rename, move, or delete the file, but redirect to a page explaining the file is temporarily unavail开发者_C百科able.

I know how to set a permanent redirect in .htaccess but this doesn't solve my problem since I'd like to make this automated via a php script....

Any suggestions? Thanks in advance.


You won't be able to do this with PHP alone unless your web server is set up to process requests for .exe files as .php, or you add a rule in .htaccess. If the file exists, and .htaccess/server settings allow direct access to files, there's nothing PHP can do to stop access to it.


Honestly the simplest way would probably be to write a PHP script that edits your .htaccess file and reloads it in apache. You could just run that script whenever you needed to enable/disable access.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜