0

我这里有问题..

我有一个像这样的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

有什么建议吗??

4

1 回答 1

1

您需要将其添加到您的条件集中:

RewriteCond %{REQUEST_URI} !\.html$

如果 URL 以.html.

于 2013-03-14T10:29:43.073 回答