Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache MOD_REWRITE-URL结尾的尾随斜杠_Apache_.htaccess_Mod Rewrite_Trailing Slash - Fatal编程技术网

Apache MOD_REWRITE-URL结尾的尾随斜杠

Apache MOD_REWRITE-URL结尾的尾随斜杠,apache,.htaccess,mod-rewrite,trailing-slash,Apache,.htaccess,Mod Rewrite,Trailing Slash,你好,我正在努力解决URL关闭的问题 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} [

你好,我正在努力解决URL关闭的问题

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]`
例如,我想强制从
www.website.com/cookie policy
重定向到
www.website.com/cookie policy/
使用以下命令:

RewriteRule ^cookie-policy/?$ cookie_policy.php [NC,L]

它将在URL的末尾添加一个
/
。在测试之前,请确保清除缓存。

Thx以获取快速帮助,不幸的是,它无法工作。您已经有一个添加尾部斜杠的规则。它不起作用:)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]