【问题标题】:Have Directory Redirect to File in Directory将目录重定向到目录中的文件
【发布时间】:2016-03-04 18:22:24
【问题描述】:

我想知道是否有可能有一个像www.example.com 这样的域和一个像www.example.com/test_dir 这样的目录,在test_dir 中有一个名为test.html 的文件和另一个名为test2.html 的文件和@ 987654326@ 或其他方式将www.example.com/test_dir 重定向到www.example.com/test_dir/test.html

谢谢

【问题讨论】:

    标签: html .htaccess file url redirect


    【解决方案1】:

    你可以在root中使用.htaccess:

    RewriteEngine On
    RewriteRule ^test_dir/?$ test_dir/test.html [NC,L]
    

    如果您想更改 URL。使用:[NC,R=301,L]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-28
      • 2015-10-08
      • 1970-01-01
      • 1970-01-01
      • 2014-10-25
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多