【问题标题】:How to access the default index page after using DirectoryIndex in .htaccess在 .htaccess 中使用 DirectoryIndex 后如何访问默认索引页面
【发布时间】:2010-08-04 23:15:32
【问题描述】:

我的站点根目录是该站点的英文版 (/index.php)。

默认情况下,我使用 DirectoryIndex 将我的用户指向该网站的法语版本 (/fr/index.php)。

我希望人们能够单击一个链接,将他们带到英文版 (/index.php)。

有没有办法在不改变文件夹结构的情况下做到这一点?

【问题讨论】:

    标签: php html apache .htaccess


    【解决方案1】:

    直接链接到/index.php。您还可以将/en 别名为/,并在请求/en/en/ 时提供/index.php。示例:

    RewriteRule ^en$ index.php [QSA]
    RewriteRule ^en/(.*)$ $1 [QSA]
    

    【讨论】:

    • 不幸的是,直接链接对我不起作用。 /index.php 停留在 /fr/index.php 并且 url 停留在 site.com/index.php
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-20
    • 1970-01-01
    • 1970-01-01
    • 2013-10-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多