【问题标题】:.htaccess - Virtual Directory for a single predefined file.htaccess - 单个预定义文件的虚拟目录
【发布时间】:2011-11-12 11:03:08
【问题描述】:

.htaccess 行如何从单个 php 文件创建虚拟目录?

www.domain.de/file.php 应该去 www.domain.de/file/

不是所有的php文件,本例中只有一个预定义的file.php

谢谢!

【问题讨论】:

    标签: .htaccess directory


    【解决方案1】:
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^file.php$ file/ [L] 
    </IfModule>
    

    【讨论】:

      【解决方案2】:

      我就是这样解决的:

      DirectoryIndex index.php
      RewriteEngine on
      RewriteRule ^file/ file.php [L]
      Options -Indexes
      

      【讨论】:

        猜你喜欢
        • 2012-03-11
        • 1970-01-01
        • 2011-12-26
        • 1970-01-01
        • 1970-01-01
        • 2012-05-07
        • 1970-01-01
        • 2013-10-20
        • 2013-11-06
        相关资源
        最近更新 更多