mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
Fix Apache URL rewriting (#16936)
This commit is contained in:
committed by
Alexander Makarov
parent
db1d730695
commit
bca1e88fbd
@ -218,15 +218,17 @@ DocumentRoot "path/to/basic/web"
|
|||||||
<Directory "path/to/basic/web">
|
<Directory "path/to/basic/web">
|
||||||
# use mod_rewrite for pretty URL support
|
# use mod_rewrite for pretty URL support
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
|
||||||
|
# if $showScriptName is false in UrlManager, do not allow accessing URLs with script name
|
||||||
|
RewriteRule ^index.php/ - [L,R=404]
|
||||||
|
|
||||||
# If a directory or a file exists, use the request directly
|
# If a directory or a file exists, use the request directly
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
|
||||||
# Otherwise forward the request to index.php
|
# Otherwise forward the request to index.php
|
||||||
RewriteRule . index.php
|
RewriteRule . index.php
|
||||||
|
|
||||||
# if $showScriptName is false in UrlManager, do not allow accessing URLs with script name
|
|
||||||
RewriteRule ^index.php/ - [L,R=404]
|
|
||||||
|
|
||||||
# ...other settings...
|
# ...other settings...
|
||||||
</Directory>
|
</Directory>
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user