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

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

报告相同问题?