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 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分