.htaccess 如何通过2个地址访问站点
我现在有一个地址为.htaccess 如何通过2个地址访问站点,.htaccess,.htaccess,我现在有一个地址为https://example.com/。如何通过地址https://example.com.html?在htaccess中写什么 在htaccess中写什么 没什么特别的 问题不是写什么,而是在.htaccess中写什么。答案是:不要写任何把网站链接到它的名字(example.com或example.com.html)的东西。这同样适用于PHP源文件或配置文件 剩下的只是专有名称注册、名称服务器和Apache配置 关于Apache的配置,假设web服务器的IP地址是1.2.3
https://example.com/
。如何通过地址https://example.com.html
?在htaccess中写什么
在htaccess中写什么
没什么特别的
问题不是写什么,而是在.htaccess
中写什么。答案是:不要写任何把网站链接到它的名字(example.com
或example.com.html
)的东西。这同样适用于PHP源文件或配置文件
剩下的只是专有名称注册、名称服务器和Apache配置
关于Apache的配置,假设web服务器的IP地址是1.2.3.4
。Apache配置文件(httpd.conf
f.e.)现在包含类似的内容:
<VirtualHost 1.2.3.4:80>
ServerName example.com
DocumentRoot "/www/docs/example.com"
# Other configuration directives for domain example.com
</VirtualHost>
假设您已经拥有名称,并且名称服务器已正确配置为指向现有服务器,请重新启动Apache,它应该可以工作
阅读更多关于和您的意思是希望能够使用
example.com.html
作为主机名访问此网站?这无法使用.htaccess完成,这需要在DNS级别和服务器配置中进行修改。
<VirtualHost 1.2.3.4:80>
ServerName example.com
ServerAlias example.com.html
DocumentRoot "/www/docs/example.com"
# Other configuration directives for domain example.com
</VirtualHost>