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

  • SEARCH
  • Home
  • 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 8638957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:52:30+00:00 2026-06-12T10:52:30+00:00

I need to redirect all requests coming from www.mysite.com to mysite.com I have found

  • 0

I need to redirect all requests coming from www.mysite.com to mysite.com

I have found the solution in rails, but how can I do that in Django/Python?

The only solution I could find, which was posted by a moderator on GoDaddy was the above. Seems like I cannot resolve this kind of problem through the DNS Manager of GoDaddy.

  • 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-12T10:52:32+00:00Added an answer on June 12, 2026 at 10:52 am

    Solved with this:

    from django.http import HttpResponsePermanentRedirect
    
    class WWWRedirectMiddleware(object):
        def process_request(self, request):
            if request.META['HTTP_HOST'].startswith('www.'):
                return HttpResponsePermanentRedirect('http://example.com')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using .htaccess, I need to redirect all requests from http://www.domain, http://domain, https://domain to; https://www.domain.com
I need to redirect all image requests from site.com/folder1/folder2/images/name.jpg to site.com/folder3/folder4/folder5/images/name.jpg Where name is
I need to update my .htaccess file to redirect permanently all URLs from http://example.com/pages/5604/article/something/?page=299
I'm using LAMP server, and I need to redirect requests like: www.www.example.com to www.example.com
I need two things Redirect all requests from http://127.0.0.1 to http://127.0.0.1/cakephp Redirect all requests
I need clean urls (e.g. example.com/test) to redirect all requests without a file extension
I need to redirect from a main domain like mydomain.com or www.mydomain.com to sub.mydomain.com
Ho can i redirect all requests for pattern host.com/* to otherhost.com/* For example all
I want to redirect all incoming requests to a subdirectory, but can't figure out
I need to redirect all page requests (php, if that matters) on a specific

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.