donqh00404 2016-03-04 01:47
浏览 55
已采纳

htaccess URL使用多个GET变量和相对URL重写

In .htaccess, I have put a simple RewriteRule with two GET variables in the URL:

RewriteRule ^myurl/([0-9a-zA-Z]+)/([0-9a-zA-Z]+) /folder_1/myfile.php?a=$1&b=$2

Inside folder_1, there are two files: myfile.php and myCSS.css

In myfile.php, when I am having to refer to myCSS.css, I am having to do:

<link href="../../folder_1/myCSS.css" rel="stylesheet"> 

The ../../ is needed to get past the two GET variables set above.

But surely, there must be a better way, as I should be able to add more GET variables and not having to change the relative URL to the CSS each time.

  • 写回答

1条回答 默认 最新

  • duanmeng2842 2016-03-04 02:01
    关注

    To fix this,you can add the following base tag to the head of your document :

    <base href="http://example.com/">
    

    For more info,see this post Seo Friendly Url css img js not working

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

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料