Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect to url with commas
    text
    copied!<p>I am trying to write a redirect for urls of this website using flask: <a href="http://nachbarschaft.immobilienscout24.de/adressen/bayern,muenchen,haidhausen/dienstleistung/friseur-blatter-hauptverwaltung,66512592.html" rel="nofollow">http://nachbarschaft.immobilienscout24.de/adressen/bayern,muenchen,haidhausen/dienstleistung/friseur-blatter-hauptverwaltung,66512592.html</a></p> <p>The code I use: </p> <pre><code>@app.route('/api/redirect', methods=['GET']) def redirect_link(): url = request.values.get('url') return redirect(url) </code></pre> <p>The problem is that the target website doesn't decode <code>%2C</code> to <code>,</code> but to <code>-</code> and gives a <code>404 Not Found</code>.</p> <p>Is there any way around this?</p> <p>Headers with curl:</p> <pre><code>curl -IL http://XXXXXX/api/redirect?url=http%3A%2F%2Fnachbarschaft.immobilienscout24.de%2Fadressen%2Fbayern%2Cmuenchen%2Chaidhausen%2Fdienstleistung%2Ffriseur-blatter-hauptverwaltung%2C66512592.html HTTP/1.1 302 FOUND Server: gunicorn/18.0 Date: Wed, 11 Dec 2013 12:58:26 GMT Connection: keep-alive Content-Type: text/html; charset=utf-8 Content-Length: 489 Location: http://nachbarschaft.immobilienscout24.de/adressen/bayern%2Cmuenchen%2Chaidhausen/dienstleistung/friseur-blatter-hauptverwaltung%2C66512592.html HTTP/1.1 301 Moved Permanently Date: Wed, 11 Dec 2013 12:58:27 GMT Location: /adressen/bayern-muenchen-haidhausen/dienstleistung/friseur-blatter-hauptverwaltung-66512592.html Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-Content-Type-Options: no-sniff Cache-Control: max-age=604800, private, must-revalidate Content-Type: text/html; charset=UTF-8 Set-Cookie: TS8a1db5=ea90e6be799ade80c5c84f3cca057558d12f3da1cca67c5a52a86172; Path=/ Transfer-Encoding: chunked HTTP/1.1 404 Not Found Date: Wed, 11 Dec 2013 12:58:27 GMT Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-Content-Type-Options: no-sniff Cache-Control: max-age=604800, private, must-revalidate Content-Type: text/html; charset=UTF-8 Set-Cookie: TS8a1db5=61dcb89e16f8fe72a87d5e1f1faf7b0e82cbf7e476e5a3ff52a86172; Path=/ Transfer-Encoding: chunked </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload