删除htaccess中的最后一个斜杠或正斜杠

时间:2016-12-02 17:25:10

标签: .htaccess

其他域名

http://domain.com/name/directory/brand/ <<< this last slash
http://domain.com/name/directory/check/me/ <<< this last slash

主页

http://doamin.com/name/directory/index.php

我的意图是该人输入的任何网址,它将始终重定向到他们的主页面,我还想删除最后一个网址的最后一个斜杠或正斜杠,不管他们输入的是什么网址,我不想要包含最后一个斜杠。

我确实让他们重定向到main,但我无法删除网址。

这是我的代码

RewriteEngine on

# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} /(.*)/$
RewriteRule ^ /%1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /name/directory/index.php [QSA,L]

谢谢

1 个答案:

答案 0 :(得分:0)

您可以使用:

$("#search_filter").on('keyup', function(e) {
  $("#select_street").attr('size', $("#select_street option").length);
  //...
});