猿问

Htaccess:从URL中添加/删除尾斜杠

Htaccess:从URL中添加/删除尾斜杠

我的网站运行一个名为->wss壁纸脚本的脚本。

我的问题>我一直试图强制删除或添加尾随斜杠到我的URL结束,以防止重复的内容,并清理我的URL。

我已经尝试过各种各样的尝试,尝试了我所能想到的每一件事,也试过从网上下载,但是还没有这样的运气!这可能是一个快速的解决办法,但我已经看了太多,我可能对一些非常明显的东西视而不见。

所以我把我所有的.htaccess代码:

DirectoryIndex index.php


RewriteEngine on

RewriteRule ^download/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+) image.php?id=$1&width=$2&height=$3&cropratio=$4&download=1 [L]

RewriteRule ^file/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+) image.php?id=$1&width=$2&height=$3&cropratio=$4 [L]

RewriteRule ^preview/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+) wallpaper_preview.php?id=$1&width=$2&height=$3&name=$4 [L]

RewriteRule ^thumbnail/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/]+) image.php?wallpaper_id=$1&width=$2&height=$3&cropratio=$4&align=$5&valign=$6&file=$7 [L]

RewriteRule ^cat/([0-9]+)?/([^/\.]+)/p([0-9]+) index.php?task=category&id=$1&name=$2&page=$3 [L]

RewriteRule ^cat/([0-9]+)?/([^/\.]+)/([0-9a-zA-Z?-]+)/p([0-9]+) index.php?task=category&id=$1&name=$2&sortby=$3&page=$4 [L]

RewriteRule ^cat/([0-9]+)?/([^/\.]+)/([0-9a-zA-Z?-]+)-([0-9]+) index.php?task=category&id=$1&sortby=$3&page=$4 [L]

RewriteRule ^cat/([0-9]+)?/([^/\.]+) index.php?task=category&id=$1&name=$2 [L]

RewriteRule ^tag/([^/\.]+)/([0-9a-zA-Z?-]+)/([0-9]+) index.php?task=tag&t=$1&sortby=$2&page=$3 [L]

RewriteRule ^tag/([^/\.]+) index.php?task=tag&t=$1 [L]

RewriteRule ^profile/([0-9]+)?/([^/\.]+) index.php?task=profile&id=$1&name=$2 [L]

RewriteRule ^profile/comments/([0-9]+)?/([^/\.]+) index.php?task=users_comments&id=$1&name=$2 [L]

RewriteRule ^page/([0-9]+) index.php?task=view_page&id=$1 [L]  

RewriteRule ^register index.php?task=register [L] 

RewriteRule ^lost-password index.php?task=lost_pass [L] 

RewriteRule ^links index.php?task=links [L]

RewriteRule ^news/item/([0-9]+)/([^/\.]+) index.php?task=news&id=$1 [L]

RewriteRule ^news/page([0-9]+) index.php?task=news&page=$1 [L

阿晨1998
浏览 857回答 3
3回答
随时随地看视频慕课网APP
我要回答