简体   繁体   English

apache config动态documentroot

[英]apache config dynamic documentroot

we are programming a website in a test environment. 我们正在测试环境中对网站进行编程。 This website will have 2 languages with urls like domain-language.com eventually we need to switch over to a situation like domain/language.com 该网站将提供2种语言的url,如domain-language.com,最终我们需要切换到domain / language.com之类的情况

can we set up apache so that it can listen to domain/language.com and depending on the approach the documentroot changes towards the subfolder of the aproached language? 我们是否可以设置apache,以便它可以收听domain / language.com,并根据documentroot更改为所指语言的子文件夹的方式而定? because we have a lot of hardcoded links on our website which might all have to be changed if the documentroot is a level higher . 因为我们的网站上有许多硬编码的链接,如果documentroot级别更高的话,可能必须全部更改。

the folder structure how i think it will look like is 文件夹结构,我认为它看起来像是

/- language1 language2 if i browse towards domain/language1.com i should get the subfolder language 1 as documentroot , making it the / /-language1 language2如果我浏览domain / language1.com,我应该将子文件夹语言1作为documentroot,使其成为/

First of all, you can't use "/" within a domain name I guess. 首先,我猜您不能在域名中使用“ /”。 "/" is always using in Apache and browser as a delimiter between domain name and file/sub-folder. 在Apache和浏览器中,“ /”始终用作域名和文件/子文件夹之间的分隔符。 Hence try to use other symbols like "-", "_" etc to replace the "/". 因此,尝试使用其他符号(例如“-”,“ _”等)代替“ /”。 In fact, it's definitely possible to set different Docroot for different domains.. any change in domain name (in your case it's language1 and language2) is considered as a different domain which can be mapped to separate DocRoot folder. 实际上,绝对可以为不同的域设置不同的Docroot。.域名的任何更改(在您的情况下为language1和language2)都被视为不同的域,可以映射到单独的DocRoot文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM