所以我创建了一个跨多个站点相同的模板系统,唯一改变的是配置文件.我正在制作所有文件都是从根目录中获取的.我可以使用我的所有php和html文件来完成它,但我无法在我的.htaccess文件中找到它.如何设置目录是/ home / user_name / template,然后还有/home/user_name/site1.com等文件夹以及所有站点外的文件夹.那么我怎么能让所有网站使用相同的.htaccess文件.我希望这是有道理的!
解决方法:
根据维基百科
A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration. They are placed inside the web tree, and are able to override a subset of the server’s global configuration for the directory that they are in, and all sub-directories
If you enable .htaccess files, the server checks for .htaccess files before serving resources. The server looks for .htaccess files in the same directory as the resource and in that directory’s parent directories, up to and including the document root.
例如,
如果主文档目录设置为/ oracle / server / docs
和a
客户请求/oracle/server/docs/reports/index.html,
服务器将检查:
.htaccess files at /oracle/server/docs/reports/.htaccess and /oracle/server/docs/.htaccess.
假设您有2个站点,并且您希望使用单个文件为两个站点设置.htaccess
然后只需创建如下的文件结构
>父母
> site1
> site2
> .htaccess
这里将site1的所有数据上传到site1文件夹,依此类推.
标签:apache,php,htaccess
来源: https://codeday.me/bug/20190611/1221687.html