【问题标题】:htaccess get content from subfolderhtaccess 从子文件夹中获取内容
【发布时间】:2012-08-03 17:23:00
【问题描述】:

我搜索了很多,但找不到我想要的信息。我有一个域http://mydomain.com,我的 html 文件嵌套在 3 级子文件夹中(例如,thingy.html 嵌套在 t/h/i/ 文件夹中,testy.html 嵌套在 /t/e/s/ 文件夹中

现在我想在浏览器中输入http://mydomain.com/testy.htmlhttp://mydomain.com/thingy.html,它应该会显示这些文件的内容,而不会重定向到http://mydomain.com/t/h/i/thingy.htmlhttp://mydomain.com/t/e/s/testy.html

这可行吗?

谁能帮帮我?我是 .htaccess 的新手

【问题讨论】:

    标签: .htaccess nested directory


    【解决方案1】:

    除非这些 3 级子文件夹的命名方式具有某种确定性,否则您必须明确且分别地对每个子文件夹进行命名。例如,您文档根目录中的 htaccess 文件,您可以拥有:

    RewriteEngine On
    RewriteRule ^/?thingy.html$ /t/h/i/thingy.html [L]
    RewriteRule ^/?testy.html$ /t/e/s/testy.html [L]
    

    等等

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-27
      • 1970-01-01
      • 2022-08-22
      • 2015-12-10
      • 2022-06-23
      • 1970-01-01
      相关资源
      最近更新 更多