将旧URL重定向到.htaccess中的新URL

z5btuh9x  于 2022-11-16  发布在  其他
关注(0)|答案(1)|浏览(231)

.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?

vcudknz3

vcudknz31#

当您已经使用netteRouter时,您可以使用单向路由器规则
即https://doc.nette.org/en/application/routing#toc-one-way-flag

相关问题