【问题标题】:.htaccess rule to skip folder name from entire urls.htaccess 规则从整个 url 中跳过文件夹名称
【发布时间】:2017-12-26 06:01:38
【问题描述】:

我的项目名称是 funfeesa,所有客户端页面都包含在“客户端”文件夹中。但是我想访问然后而不在 url 中写入客户端文件夹。 就像下面这样:

localhost/funfeesa/index.php

我在.htaccess 文件中尝试了许多规则,但都没有正常工作。 谁能帮帮我?

【问题讨论】:

    标签: .htaccess url-rewriting localhost


    【解决方案1】:
    #prevent directory listing
    Options -Indexes
    IndexIgnore */*
    
    
    #follow symbolic links
    Options FollowSymlinks
    RewriteEngine on
    RewriteRule ^funfeesa/index.php(.+)?$ funfeesa/client/index.php/$1
    

    尝试像上面那样访问你的 .htaccess 文件

    如果它不起作用,请尝试从上述规则中删除 index.php,但我认为它应该起作用 :)

    【讨论】:

    • 非常感谢您的快速帮助。但即使没有 index.php 没有找到对象,它也无法工作!当我访问 localhost/funfeesa/index.php
    • @NafisaKanwal 尝试删除 Options -Indexes IndexIgnore */* 这行
    • 我现在重定向到localhost/client/funfeesa/index.php 它开始在项目文件夹名称之前附加“客户”文件夹
    猜你喜欢
    • 2014-03-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-16
    • 2012-08-20
    • 2016-03-30
    • 2016-04-13
    • 1970-01-01
    相关资源
    最近更新 更多