我在这里有问题..
我有像这样的htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
# Rewrite cuiy
RewriteEngine On
# Ensure all URLs have a trailing slash.
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://store.kiosban.com/$1/ [L,R=301]
RewriteRule ^produk/([^/]*)/([^/]*)\.html$ /template/single-product.php?produk=$1&slug=$2 [L] #single produk
RewriteRule ^produk/([^/]*)$ /template/product.php?produk=$1 [L] #archive produk
RewriteRule ^produk/$ http://www.store.kiosban.com/produk/all [R=301,L]
RewriteRule ^produk/([^/]*)/([^/]*)$ /template/product.php?produk=$1&page=$2 [L] #archive produk
RewriteRule ^filter/([^/]*)/ukuran/([^/]*)$ /template/search.php?filter=$1&ukuran=$2 [L] #search by size
RewriteRule ^filter/([^/]*)/ukuran/([^/]*)/([^/]*)$ /template/search.php?filter=$1&ukuran=$2&page=$3 [L] #search by size
RewriteRule ^filter/([^/]*)/oem/([^/]*)$ /template/search.php?filter=$1&oem=$2 [L] #search by oem
RewriteRule ^filter/([^/]*)/oem/([^/]*)/([^/]*)$ /template/search.php?filter=$1&oem=$2&page=$3
RewriteRule ^checkout/$ /template/checkout.php
RewriteRule ^checkout/2/ /template/product.php
RewriteRule ^login/$ /template/mlebu.php
RewriteRule ^daftar/$ /template/register.php
如果我插入这样的网址
,它会起作用http://store.kiosban.com/produk
会变成这样的
http://store.kiosban.com/produk/
问题是当网址是这样的时候
http://store.kiosban.com/produk/accesories/accesories.html
它也会变得像这样
http://store.kiosban.com/produk/accesories/accesories.html/
我的问题是..当url不是.html文件时如何添加尾部斜杠......
http://store.kiosban.com/produk
成为
http://store.kiosban.com/produk/
并且
http://store.kiosban.com/produk/accesories/accesories.html
仍在
http://store.kiosban.com/produk/accesories/accesories.html
任何建议??
答案 0 :(得分:1)
您需要将其添加到条件集中:
RewriteCond %{REQUEST_URI} !\.html$
如果网址以.html
结尾,则应阻止规则运行。