Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9281217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:03:44+00:00 2026-06-18T18:03:44+00:00

I want to implement structure in Flask, which can handle multiple domains. So when

  • 0

I want to implement structure in Flask, which can handle multiple domains.
So when I type in browser “http://domain1.com/show/1“, it actually executes function with routing like

@app.route('<string:domain>/show/<int:id>')
def show(domain = '', id = ''):
    return 'Domain is ' + domain + ', ID is ' + str(id)

And it is very important, the URL in client’s browser should be still “http://domain1.com/show/1“. And as I know, when using redirect in Flask, it changes url. How should I organise such structure? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T18:03:45+00:00Added an answer on June 18, 2026 at 6:03 pm

    The request object already has a url_root parameter. Or you can use the Host header:

    print request.url_root  # prints "http://domain1.com/"
    print request.headers['Host']  # prints "domain1.com"
    

    If you need to redirect within the application, url_root is the attribute to look at, as it’ll include the full path for the WSGI application, even when rooted at a deeper path (e.g. starting at http://domain1.com/path/to/flaskapp).

    It probably is better still to use request.url_for() to have Flask generate a URL for you; it’ll take url_root into account. See the URL Building documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement a table structure which can have multiple rows and columns
I basically want to implement something where you can type in any URI (
i want to implement this. (http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=1;illustIndex=0;sampleId=0) type of structure in my application.how can i
I have following navigation structure, which i want to implement in wordpress: (Home /
I want to implement a tree structure which has fixed depth, i.e. when adding
I want to implement a data structure which looks something like this. {{RowID, N1,
I have a data structure of key value pairs and I want to implement
I want to implement an application which will work as a parser. User will
I want to implement a taxonomy structure (geo terms) for my node.js application with
I want to implement a heap data structure and want to apply the code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.