duanpu6319 2017-04-06 18:56
浏览 56
已采纳

.htaccess RewriteRule在切换提供程序后无法正常工作

I want to have a short link for images hosted on my website. An example:

http://quartzic.co/sharex/quartzic/UUd.png

The short link:

i.quartzic.co/nUUd

The subdomain "i" redirects to http://quartzic.co/sharex, and the "n" character indicates the directory the file is stored in. The expected behaviour is to visit the short link, and view the image file hosted at the long link (without the URL changing in the browser).

Here's the .htaccess file I have in the /sharex/ directory:

RewriteEngine On
RewriteBase /
RewriteRule ^n(.*)$ /quartzic/$1.png [P,L]

This issue presented itself after switching hosting providers, even though the exact same thing worked on my previous host.

  • 写回答

1条回答 默认 最新

  • duanbigan7765 2017-04-06 19:00
    关注

    This is assuming your have mod_proxy correctly setup on new host.

    Fix your RewriteBase and use a relative URI in target:

    RewriteEngine On
    RewriteBase /sharex/
    
    RewriteRule ^n(.*)$ quartzic/$1.png [P,NC,L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数