Apache mod_rewrite使用别名添加尾部斜杠

时间:2015-12-31 12:24:44

标签: apache .htaccess mod-rewrite

我想使用重写引擎在URI中强制使用尾部斜杠。

http://www.mysite.it/test -> http://www.mysite.it/test/

这是我的配置:

 RewriteEngine On
 RewriteRule ^([a-zA-Z0-9_]+)$ http://www.mysite.it/$1/ [L,R=302]
 #this is an .htaccess config

这仅适用于服务器名称" www.mysite"。 如何概括它以遵循服务器别名?

http://www.mysite.it/test -> http://www.mysite.it/test/
http://www.myalias.it/test -> http://www.myalias.it/test/
http://www.anotheralias.it/test -> http://www.anotheralias.it/test/

1 个答案:

答案 0 :(得分:-1)

使用imageView.setOnDragListener(new View.OnDragListener() { @Override public boolean onDrag(View v, DragEvent event) { switch(event.getAction()) { case DragEvent.ACTION_DRAG_STARTED: Log.e(msg, "Action is DragEvent.ACTION_DRAG_STARTED"); return true; case DragEvent.ACTION_DRAG_ENTERED: Log.e(msg, "Action is DragEvent.ACTION_DRAG_ENTERED"); return true; case DragEvent.ACTION_DRAG_EXITED : Log.e(msg, "Action is DragEvent.ACTION_DRAG_EXITED"); break; case DragEvent.ACTION_DRAG_LOCATION : Log.e(msg, "Action is DragEvent.ACTION_DRAG_LOCATION"); break; case DragEvent.ACTION_DRAG_ENDED : Log.e(msg, "Action is DragEvent.ACTION_DRAG_ENDED"); break; case DragEvent.ACTION_DROP: Log.e(msg, "ACTION_DROP event"); break; default: break; } return true; } }); 变量从请求中选择主机名:

%{HTTP_HOST}

PS:RewriteEngine On RewriteRule ^(\w+)$ http://%{HTTP_HOST}/$1/ [NE,L,R=302] \w

相同