第一步:xampp在的根目录:
复制粘贴:下面的
代码语言:javascript复制# prevent directory listings
Options -Indexes
# follow symbolic links
Options FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/admin/$
RewriteRule ^(admin)/$ /$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^admin(/. )?$ /backend/web/$1 [L,PT]
RewriteCond %{REQUEST_URI} ^.*$
RewriteRule ^(.*)$ /frontend/web/$1
第二步:在backendweb里面创建一个.htaccess文件(复制粘贴下来的代码)
第二步:在frontendweb里面创建一个.htaccess文件(复制粘贴下来的代码)
代码语言:javascript复制# 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
第三步:frontendconfigmain.php文件中复制粘贴下面的代码;就行了
代码语言:javascript复制 'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules'=>[
'<controller:w >/<action:w >'=>'<controller>/<action>',
],
]