.htaccess重定向到子文件夹不起作用

时间:2016-10-16 12:59:46

标签: .htaccess

如何重定向到"后端"或"前端"在以下项目结构中使用htaccess的目录?:

我在.htaccess中试过这段代码,但它不起作用:

<IfModule mod_rewrite.c>
Options -Indexes
RewriteEngine on

# Change '/myproject/' if directory is renamed
RewriteBase /myproject/
# Change the '/myproject/' portion of the condition if directory is renamed
RewriteCond %{REQUEST_URI} ^/myproject/backend/(.+)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ backend/index.php?url=$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ frontend/index.php?url=$1 [QSA,L]
</IfModule>     

这是我的项目结构:     

 
        myproject/
                 frontend/
                 backend/
                 common/
                 upload/
                .htaccess
    

请帮帮我。

0 个答案:

没有答案
相关问题