本文介绍了提前模板Yii2 - 重定向使用htaccess的,以前端/网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我使用的提前模板Yii2。而使用htaccess的重定向HTTP :: //mydomain到前端/ web文件夹。
Now I am using advance template Yii2. And using htaccess to redirect http:://mydomain to frontend/web folder.
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI} ^/(assets|css|js|ember) RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L] RewriteRule ^css/(.*)$ frontend/web/css/$1 [L] RewriteRule ^js/(.*)$ web/js/$1 [L] RewriteRule ^ember/(.*)$ web/ember/$1 [L] RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js|ember)/ RewriteCond %{REQUEST_URI} !index.php RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ frontend/web/index.php/$1 [L,QSA] #RewriteRule (.*) frontend/web/$1 [L] </IfModule>
但是当我去到任何URL,即: mydomain/abc 。该网站始终指向首页。即使URL不是invailable ..
but when I go to any url ie : mydomain/abc . the site always point to home page.. Even url not invailable..
在此先感谢
推荐答案这.htaccess文件对我的作品,你必须把这个.htaccess文件下 yii2advance /前端/ 的根目录,
This .htaccess file works for me, you have to put this .htaccess file under yii2advance/frontend/ root directory,
所以,当你访问的 yii2advance/frontend / 它会改写为 yii2advance/frontend/web
so when you access yii2advance/frontend/ it'll rewrite as yii2advance/frontend/web
RewriteEngine On RewriteBase / RewriteRule ^(.*) frontend/web/index.php/$1 [QSA,L,NC]更多推荐
提前模板Yii2
发布评论