【问题标题】:.htaccess sub directory in a variable.htaccess 变量中的子目录
【发布时间】:2016-12-08 00:05:09
【问题描述】:

我想知道是否可以将我的域指向一个目录,该目录是根目录中的两个文件夹。

重点是,我通过 URL 变量通知将在内容区域显示的页面,如下所示:

www.dominio.com.br/index.php?c=products/list(这样,效果很好)

我想通过以下方式访问此路径:www.dominio.com.br/products/list

这是我的结构...

public_html

.htaccess    
index.php
**products**
    **list.php** <-- My desired folder.
customers
    list.php <-- My desired folder.
    new.php

我需要一个 .htaccess 代码来读取此 URL,变量中有子目录文件夹。现在,当使用与 index.php 位于同一文件夹中的文件时,我可以正常工作。

我希望这一切都有意义。

谢谢。

【问题讨论】:

    标签: php apache .htaccess url-rewriting


    【解决方案1】:

    如果

    www.dominio.com.br/index.php?c=products/list
    

    非常适合您,您可以使用重写规则将“虚拟”文件夹路径映射到现有页面:

    RewriteEngine On
    RewriteRule ^products/list$ index.php?c=products/list
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-12
      • 1970-01-01
      • 2012-03-21
      相关资源
      最近更新 更多