<IfModule mod_rewrite.c>
# Enable rewrite engine
RewriteEngine On
#Removes access to the system folder by users.
RewriteCond %{REQUEST_URI} ^app.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Some extra conditions
# skip these paths for redirection
RewriteRule ^img/(.*) public/assets/img/$1 [L]
RewriteRule ^css/(.*) public/assets/css/$1 [L]
RewriteRule ^js/(.*) public/assets/js/$1 [L]
RewriteRule ^plugins/(.*) public/assets/plugins/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^(.*)$ public/index.php?url=/$1 [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 /index.php
</IfModule>
这种重写是有效的,除了当我加载这样的 URL localhost/login/
(斜杠)时,它没有加载资源。当我使用localhost/login
它并加载所有图像和 CSS 文件时。有人可以帮我解决这个问题。