douzhe9927 2015-01-11 17:23
浏览 135
已采纳

将index.html从根目录更改为子目录

Right now the index.html of my website is loading from the root directory when someone enters www.mydomain.com in their browser, which as I understand it is the default behavior. I want to move all of my website files into a subdirectory (e.g. public) so that when someone loads www.mydomain.com, the index.html file it loads is in the /public/ directory on my server. However, I do not want the URL to change to www.mydomain.com/public. From there, if a link is clicked/, all of the files will be in the public directory. How would I go about achieving something like that

  • 写回答

1条回答 默认 最新

  • douhui3330 2015-01-11 17:26
    关注

    You can use this code in your DOCUMENT_ROOT/.htaccess file:

    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^((?!public/).*) public/$1 [L,NC]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?