APACHE ro NGINX:如何翻译重写规则?

时间:2018-01-12 19:13:45

标签: apache ubuntu nginx

 private void loadSongs() {
        Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
        String selection = MediaStore.Audio.Media.IS_MUSIC + "!=0";
        Cursor cursor = getContext().getContentResolver().query(uri, null, selection, null, null);
        if (cursor != null) {
            if (cursor.moveToFirst()) {
                do {

                    String name = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
                    String artist = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST));
                    String url = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA));
                    String albumId = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
                    Cursor cursorm = getContext().getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
                            new String[] {MediaStore.Audio.Albums._ID, MediaStore.Audio.Albums.ALBUM_ART},
                            MediaStore.Audio.Albums._ID+ "=?",
                            new String[] {String.valueOf(albumId)},
                            null);
                    assert cursorm != null;
                    if (cursorm.moveToFirst()) {
                        String path = cursorm.getString(cursorm.getColumnIndex(MediaStore.Audio.Albums.ALBUM_ART));
                        Drawable img = Drawable.createFromPath(path);
                        image = (ImageView)rootView.findViewById(R.id.albumArt);
                       // image.setImageDrawable(img);
                        image.setImageDrawable(ContextCompat.getDrawable(getActivity(),R.drawable.ed));
                    }
                    songInfo s = new songInfo(name, artist, url);
                    _songs.add(s);
                }
                while (cursor.moveToNext());
                cursor.close();
                recyclerView.getAdapter().notifyDataSetChanged();
            }
        }
    }

这是我的htaccess apache文件

我是一个nginx新手......不知道在哪里以及如何设置

1 个答案:

答案 0 :(得分:-1)

你可以试试这个:

# nginx configuration

location / {
  rewrite ^/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ /index.php?apple=$1&bee=$2 break;
}

此外,这是一个非常好的工具,您还可以检查:https://winginx.com/en/htaccess