当HTTP url被重定向到HTTPS时,我有一个尾部斜杠,我可以删除它。但

时间:2016-05-27 11:55:40

标签: php apache .htaccess redirect mod-rewrite

当我删除尾部斜杠时,它会将其从整个网站中删除。我正在处理的网站需要在其网址末尾添加斜杠,但在更改为HTTPS后我无法显示斜杠。我可以手动删除它然后一切都很好。任何人都可以告诉我这是默认操作还是我的htaccess执行此操作。

原因是我正在对他们希望重定向的旧URL的网站执行维护。旧的URL只是HTTP。因此,当他们被定向时,他们会更改为HTTPS并向网址添加斜杠。我将尽力在下面尽可能清楚。

**//Start of htaccess**

php_value magic_quotes_gpc off

RewriteEngine on

RewriteCond %{HTTP_HOST} ^abc.nl  
RewriteRule ^(.*)$ https://www.abc.nl/$1 [R=301,L]

RewriteBase /
RewriteCond %{REQUEST_URI} [A-Z]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L]

RewriteRule \.(css|jpe?g|gif|png|js|ico|php|pdf)$ - [L]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4-$5-$6-$7-$8-$9 [R=301,L]

RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4-$5-$6-$7-$8 [R=301,L]

RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4-$5-$6-$7 [R=301,L]

RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4-$5-$6 [R=301,L]

RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4-$5 [R=301,L]

RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3-$4 [R=301,L]

RewriteRule ^([^_]*)_([^_]*)_([^_]*)$ /$1-$2-$3 [R=301,L]

RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 [L,R=301]

RewriteRule (.*)\.xml(.*) $1.php$2 [nocase]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI}[a-z] /+[^\.]+$

ErrorDocument 404 /include/paginas/handling/htaccess_404.php

**//end htaccess**

好的,我将显示一个已定向的旧URL及其标题目的地的示例。

旧网址 - http://www.abc.nl/test/example/destination

点击后会重定向到 - https://www.abc.nl/test/example/destination/

上面的链接不起作用,只有在删除'/'时它才有效。当我手动删除'/'时,我需要 - https://www.abc.nl/test/example/destination才能正常工作。

0 个答案:

没有答案