Absolute Path for Deployment in a Non-Root Location

后端 未结 8 1379
耶瑟儿~
耶瑟儿~ 2021-01-06 13:22

I typically refer to any assets on my site using absolute path so that I don\'t have to worry about the location of the assets relative to current file.

<         


        
8条回答
  •  灰色年华
    2021-01-06 13:49

    If you’re using Apache, there one rather simple thing you could do by just using an SSI variable in your paths. Do a global replace of all src="/ to something like

    src="/
    

    and then in your htaccess for the specific folder define the prefix variable as /holiday

    For sites that don’t have the variable or SSI, it’ll just show up as a comment or you can define it as an empty string.

    Of course this means you’ll have to turn on SSI in Apache.

提交回复
热议问题