我有一个.htaccess文件,可以创建一个SEO网址。例如,让我们说丑陋的网址是:example.com/stories?url=hello-world&page=5
网址变为example.com/stories/hello-world/5
这很有效,但对于第一页,我希望URL不显示页码。例如,我希望像example.com/stories/hello-world/1
这样的网址为example.com/stories/hello-world
我该怎么办?
当前.htaccess
RewriteEngine On
RewriteBase /stories/
RewriteCond %{THE_REQUEST} /\?url=([^&\s]+)&page=([0-9]+) [NC]
RewriteRule ^ %1/%2? [L,R=302]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?url=$1&page=$2 [L,QSA]
答案 0 :(得分:1)
尝试这样,
**try this it will definitely work for you**
try {
JSONArray jsonArray=new JSONArray(response);
for (int i=0;i<jsonArray.length();i++) {
JSONObject object_one=jsonArray.getJSONObject(i);
JSONObject zero_object=object_one.getJSONObject("0");
String zerostring=zero_object.getString("program_name");
Log.e("zerostring",zerostring);
JSONObject tone_object=object_one.getJSONObject("1");
String sec=tone_object.getString("program_name");
Log.e("sec",sec);
JSONArray fourth_object_array=object_one.getJSONArray("2");
for (int j=0;j<fourth_object_array.length();j++) {
JSONObject last = fourth_object_array.getJSONObject(j);
String finas=last.getString("program_name");
Log.e("last", finas);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}