0
我正在使用一个框架,将所有URL重写为index.php,除非该文件或文件夹实际存在。.htaccess重写基础文件夹但不是内容
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]
但是,我有一个名为'media'的目录,以及一个URL为'/ media'的页面。我需要做到这一点,'/ media'会被路由到index.php,但在内部查看,'media'目录会照常显示。
所以:
http://example.com/some-page - routed through index.php (already does this)
http://example.com/media - routed through index.php as well
http://example.com/media/images/hello.jpg - asset served as usual
我曾尝试:
RewriteRule ^media$ index.php/media [PT,L]
此列出像往常一样 '媒体' 文件夹中的内容。
RewriteRule ^media/$ index.php/media
这会导致重定向循环。
我不确定其他语法的工作原理。