【问题标题】:remove cakephp 3 foldername from url从 url 中删除 cakephp 3 文件夹名
【发布时间】:2016-12-10 06:22:30
【问题描述】:

我想更改网址:

www.example.com/api/

收件人:

www.example.com/

我在哪个 api 文件夹中安装了 cakephp 3 并且工作正常。

我想删除 url 中的 api,之后它看起来像 www.example.com。有人可以帮我如何做到这一点,我不想将文件从 api 文件夹更改为根目录。 我的 api 文件夹 .htaccess 如下所示。

**.htaccess of api folder**
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]

</IfModule>

【问题讨论】:

    标签: php .htaccess cakephp url-rewriting routing


    【解决方案1】:

    在根 (www) 文件夹中添加 .htaccess 喜欢

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule    ^$    api/    [L]
        RewriteRule    (.*) api/$1    [L]
    
    </IfModule>
    

    【讨论】:

    • 感谢回复,但找不到控制器。错误显示
    猜你喜欢
    • 2014-04-22
    • 2020-03-19
    • 2023-04-10
    • 2019-07-18
    • 2016-04-13
    • 1970-01-01
    • 2014-01-22
    • 1970-01-01
    相关资源
    最近更新 更多