htaccess重写每个URL.org/(persian短语)

时间:2017-07-23 08:48:05

标签: regex .htaccess

我尝试了这个但是没有用:

public class ChatFragment extends Fragment implements View.OnClickListener {


    private EditText chatMessageBox;
    private Button chatSendButton;
    private DatabaseReference db;
    private ListView chatList;
    private FirebaseHelper firebaseHelper;
    private ChatListAdapter chatListAdapter;
    private ChatListManager chatListManager;

    public ChatFragment() {

    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View chatView = inflater.inflate(R.layout.fragment_chatroom, container, false);


        chatMessageBox = (EditText) chatView.findViewById(R.id.chatMessageBox);
        chatSendButton = (Button) chatView.findViewById(R.id.chatSendButton);
        chatSendButton.setOnClickListener(this);

        db = FirebaseDatabase.getInstance().getReference().child("chat_room");
        firebaseHelper = new FirebaseHelper(db);
        chatListAdapter = new ChatListAdapter(getActivity().getApplicationContext(), firebaseHelper.retrieve());

        chatList = (ListView) chatView.findViewById(R.id.chatList);
        chatList.setAdapter(chatListAdapter);





        return chatView;
    }

    @Override
    public void onClick(View v) {
        if (v == chatSendButton) {

            String uname = SharedPrefManager.getInstance(getActivity().getApplicationContext()).getDetails("u_name");
            String message = chatMessageBox.getText().toString();
            chatListManager = new ChatListManager(uname,message);

            firebaseHelper.sendChat(chatListManager.getChatUsername(), chatListManager.getChatMessage());
            chatListAdapter.notifyDataSetChanged();

        }
    }
}

除了包含英文字符(可能)以及一些数字,空格和此字符_的短语之外,我可以接受重写每个短语!和 - 。

作为一个例子,我想重写一遍:

RewriteRule    ^/([\u0600-\u06FF]+)/?$    /tag.php?value=$1     [NC,L]

URL.org/مطلب 2 درمورد وب

但如果URL类似于

/tag.php?value=مطلب 2 درمورد وب

我只想索引文件夹“Basic 4 Android_2”并且不做任何重写..

编辑: 让我更容易, 我只想不以这种格式重写任何网址

URL.org/Basic 4 Android_2

但我想以下列格式重写任何网址

URL.com/Completely_English_Phrase_Without_Any_NonEnglish_Chars(persian_japonese_chenese,russian and ....)

到tag.php

1 个答案:

答案 0 :(得分:2)

您可以使用此规则:

RewriteEngine On

//...
_dataSocket = new QTcpSocket(this);
connect(_dataSocket, &QTcpSocket::readyRead, this, &FakeTcpClient::ReadDataFromDataSocket);
connect(_dataSocket, &QTcpSocket::connected, this, &FakeTcpClient::ConnectedSuccessfull);
_dataSocket->abort();
_dataSocket->connectToHost("127.0.0.1", 4545);
//...
void FakeTcpClient::ReadDataFromDataSocket()
{
    qDebug() << "FakeTcpClient:: Recv data from Data > " << "...";
}
void FakeTcpClient::ConnectedSuccessfull()
{
    qDebug() << "FakeTcpClient:: CONNECTED!!!!!!!!!!!!!!!!!";
}
  • RewriteRule ^/?(.*[^\x01-\x7F].*?)/?$ tag.php?value=$1 [QSA,B,L] 将匹配任何不在ASCII范围内的字符,即[^\x01-\x7F]