douguangxiang0363 2018-05-02 20:19
浏览 62
已采纳

Windows上的Fastroute,htaccess和子文件夹

I have this structure:

www/subfold
www/subfold/public/index.php
www/subfold/.htaccess
www/subfold/...etcetera

I'm using wamp64. I need to redirect all the requests to public/index.php.

When i had index.php on www/subfold/, this .htaccess worked like a charm.

Options -Indexes

RewriteEngine On
RewriteBase /subfold/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

How can i modify this to work in subfold/public/index.php?

  • 写回答

1条回答 默认 最新

  • douqingzhi0980 2018-05-02 20:24
    关注

    Replace your code with this:

    Options -Indexes
    RewriteEngine On
    RewriteBase /subfold/
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . public/index.php [L]
    

    Note target of public/index.php in RewriteRule.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?