doz97171 2015-05-21 02:48
浏览 91

通过htaccess将下载文件重定向到新的命名文件

Over time, filenames of our software have changed for various reasons, so an old download file pointed to by shareware sites no longer exists.

I want to redirect so that if somebody clicks a link to the old file they can download the new (different named) version.

So I tried adding a .htaccess file into public_html that contains the following (and nothing else):

Redirect 301 mydomain.com/oldinstaller.exe mydomain.com/newinstaller.exe

But that didnt work, I get 500 errors issued by the server. All files are in public_html and so is the .htaccess file. Any ideas what I am doing wrong?

UPDATE

I tried the following:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^oldinstaller.msi /newinstaller.exe [R=301,L]

and the browser is given this URL:

https://example.com/home/admin/web/example.com/public_html/newinstaller.exe

And if I try:

RewriteRule ^oldinstaller.msi$ example.com/newinstaller.exe [R=301,L]

I get:

https://example.com/example.com/newinstaller.exe
  • 写回答

2条回答 默认 最新

  • dongpang4470 2015-05-21 03:02
    关注

    Try mod_rewrite redirecting using

    RewriteRule ^oldinstaller.exe /newinstaller.exe [R=301,L]
    

    or redirect by adding HTTP headers in your php page

    评论

报告相同问题?

悬赏问题

  • ¥15 有人能看一下我宿舍管理系统的报修功能该怎么改啊?链表那里总是越界
  • ¥15 cs loadimage运行不了,easyx也下了,没有用
  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥20 关于变压器的具体案例分析