Apache Yii2在配置httpd.conf之后,仍然在url中附加web文件夹
这是在yii应用程序中设置httpd.conf的步骤Apache Yii2在配置httpd.conf之后,仍然在url中附加web文件夹,apache,mod-rewrite,yii2,httpd.conf,Apache,Mod Rewrite,Yii2,Httpd.conf,这是在yii应用程序中设置httpd.conf的步骤 Alias /attendance "C:/wamp/www/myproject/web" <Directory "C:\wamp\www\myproject\web"> # use mod_rewrite for pretty URL support RewriteEngine on # If a directory or a file exists, use the request directly
Alias /attendance "C:/wamp/www/myproject/web"
<Directory "C:\wamp\www\myproject\web">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
Alias/attention“C:/wamp/www/myproject/web”
#使用mod_rewrite获得漂亮的URL支持
重新启动发动机
#如果存在目录或文件,请直接使用请求
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#否则,将请求转发到index.php
重写规则。index.php
#…其他设置。。。
如果我在浏览器中打开它,效果会很好
http://localhost/attendance/
但是当我导航到页面时,比如about、contact、Login
它将在url中使用myproject
,如下所示
http://localhost/myproject /网站/网站/关于
您还可以看到,web文件夹附加在url中
如何使用我的别名并删除url中附加的web将
DocumentRoot
设置到项目路径“C:/wamp/www/myproject/web”