我已经尝试了在键入它们时重定向我的页面的所有代码,并在其后缀为根 URL,但它仅适用于不是文件夹的 URL,即对于链接 /mylink.html 我有文件夹“mylink”,在它里面我放我的文章,所以我尝试访问该文章,它表现良好,但是每当我单击与包含子页面的文件同名的文件夹时,它就会破解为 401 或 500 错误!
先感谢您!
这是我的代码:
# redirect trailing at the end
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpg|png|ico|webp|jpeg|css|js)$ [NC]
RewriteRule ^(.*)$ https://example.com/$1/ [L,R=301]