Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
site.com/some_page.html好吧,我需要我的页面在地址上可用:site.com/some_page/ 解决方案是:
site.com/some_page.html
site.com/some_page/
RewriteEngine on RewriteRule ^(.*)/$|!^(.*)/(.*)\.css$ $1.html
但是有一个问题,单个页面在两个请求中都可以作为两个不同的页面使用。如何使用 301 重定向重定向site.com/some_page.html到?site.com/some_page/
使用 mod_alias
RedirectMatch 301 ^/some_page\.html$ /some_page/
或使用 mod_rewrite
RewriteRule ^/?some_page\.html$ /some_page/ [R=301,L]