douchuitang0331 2013-04-21 12:58
浏览 44
已采纳

URL重写图像

My .htaccess file

Options +FollowSymLinks
RewriteEngine on

RewriteRule     ^the-image-([A-Za-z0-9]+)-([A-Za-z0-9+]+)/?$  images/userfolder/$1/$2 [NC,L] #Loading Images

And in my PHP page

<img src='./the-image-$username-$image_id' alt='User Image' />

My aim is to load the image for each user based upon his username and Image ID.

The username is stored under $username and Image ID under $image_id variables. And the images will be located under images/userfolder/username/image.jpg

But the images are not getting loaded. What is the error in my syntax?

Note: The Image ID variable holds both the image name and it' extension. Example : 1.jpg

  • 写回答

2条回答 默认 最新

  • dongqiao5573 2013-04-21 13:14
    关注

    You may try this instead:

    RewriteRule  ^the-image-([^-]+)-([^-]+)/?$  images/userfolder/$1/$2 [NC,L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源