Home > Enterprise >  Response Code 301 while sending request from Android
Response Code 301 while sending request from Android

Time:05-08

I need help, my app was working fine but after renew of Domain name, I started getting error 301. Is something to be fixed in my below code? Though if I use https://Google.com with same code, response code is 200. Hostgator is also not able to find the issue to fix. Can someone help, pls.

Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
        try {
            URL url = new URL("http://innovativeapps.me");
            HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
            httpURLConnection.connect();
            int con_respone_code = httpURLConnection.getResponseCode();
            Log.i("Response Code: ", con_respone_code   "");
            Log.i("Error Message", httpURLConnection.getResponseMessage());
            httpURLConnection.disconnect();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
});

thread.start();

If i open this using web browser, the url is working fine.

CodePudding user response:

Your site is being redirected to https://innovativeapps.me. When you use the http:// schema, it redirects and returns a 301 letting you know that you need to update your url.

  • Related