.htaccess 文件
# Apache configuration file (see httpd.apache.org/docs/current/mod/quickreference.html)
# disable directory listing
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# enable cool URL
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteBase /
# prevents files starting with dot to be viewed by browser
RewriteRule /\.|^\.(?!well-known/) - [F]
# front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz|map)$ index.php [L]
</IfModule>
# enable gzip compression
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
</IfModule>
</IfModule>
我使用 Nette FW,我想从 Nette\Application\Routers\SimpleRouter 迁移到很酷的 URL。
http://test.localhost/?action=add&presenter=Cr => http://test.localhost/cr/add
http://test.localhost/?id=303&action=edit&presenter=Cr => http://test.localhost/cr/edit/?id=30
如何将所有 URL 重定向到新 URL?
当您已经使用netteRouter时,您可以使用单向路由器规则
即。 https://doc.nette.org/en/application/routing#toc-one-way-flag