dqs13465424392 2010-07-28 13:50
浏览 48
已采纳

使用php和.htaccess重写友好的URL。 与css图像和js相关链接的困难

I've currently an url like that : play.php?place=idplace&event=idevent

I've enabled friendly url this way :

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ play.php?place=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ /play.php?place=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ /play.php?place=$1&event=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ /play.php?place=$1&event=$2

For just one parameter (the place id there), all is ok. But when it comes two params (place and event) like that mysite/theplace/theevent all my relatives links (css, js and imgs) are not working, my page seems to think it is actually in the theplace/ folder, and non in the root/ one.

Ideas for this issue?

Thanx a lot

Guillaume

  • 写回答

1条回答 默认 最新

  • dpj83664 2010-07-28 13:54
    关注

    You must use paths that are absolute from at least the domain, i.e.

    /images/myimage.png
    

    You may be able to fix this one problem in another way, but it will only become more annoying as your URL rewriting becomes more advanced.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 slam rangenet++配置
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊