Options -Indexes +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteCond %{HTTP_HOST} !^(.*)\.(.*)\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ HTTP%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
ServerSignature Off
RewriteRule ^cookie-policy/?$ cookie_policy.php [NC,L]`您好,我真的很努力与URL结束尾部斜杠。
RewriteRule ^cookie-policy/?$ cookie_policy.php [NC,L]例如,我想强制从www.website.com/cookie-policy重定向到www.website.com/cookie-policy/
发布于 2017-01-12 18:05:52
使用以下命令:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]它会在你的URL末尾添加一个/。在测试之前,请确保清除缓存。
https://stackoverflow.com/questions/41609512
复制相似问题