The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. How to make multiple url redirection using global.asax in IIS 6?

    How to make multiple url redirection using global.asax in IIS 6?

    Technical SEO Issues
    2 2 2.4k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • VipinLouka78
      VipinLouka78 last edited by

      sir,

      I am working with IIS 6 site and i ant to redirect three different urls of a domain to one url, i.e, there are the different versions of the same url...so how can i create one? I have found a script on google. but it says redirecting one url. see it here:

      Sub Application_BeginRequest(ByVal sender as Object, ByVal e as EventArgs)
      
      Try
      	Dim requestedDomain As String = HttpContext.Current.Request.Url.ToString().toLower()
      
      	If InStr(requestedDomain, "http://yoursite.com") Then
      
      		requestedDomain = requestedDomain.Replace("http://yoursite.com", "http://www.yoursite.com")
      
      		Response.Clear()
      		Response.Status = "301 Moved Permanently"
      		Response.AddHeader("Location", requestedDomain)
      		Response.End()
      
      	End If
      
      Catch ex As Exception
      	Response.Write("Error in Global.asax :" & ex.Message)
      End Try
      
      End Sub
      
      1 Reply Last reply Reply Quote 0
      • lavellester
        lavellester last edited by

        I'd recommend implementing 301 at the server level e.g. in IIS settings rather than the code level.

        There are loads of guides on this - just search for "301 iis6 redirect" on your favourite search engine.

        Hope this helps.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        • Using a 302 redirect for language variants. How should I use the canonical?
          GPainter
          GPainter
          0
          4
          50

        • Change URL or use Canonicals and Redirects?
          LoganRay
          LoganRay
          0
          5
          85

        • If I want clean up my URLs and take the "www.site.com/page.html" and make it "www.site.com/page" do I need a redirect?
          Booj
          Booj
          0
          4
          113

        • Should I make a new URL just so it can include a target keyword, then 301 redirect the old URL?
          Kurt_Steinbrueck
          Kurt_Steinbrueck
          0
          5
          153

        • Crawl reveals hundreds of urls with multiple urls in the url string
          irvingw
          irvingw
          0
          5
          455

        • Old URL redirect to New URL
          Dr-Pete
          Dr-Pete
          0
          7
          695

        • Not sure which URL to use for 301 redirect
          CeCeBar
          CeCeBar
          0
          7
          435

        • Trailing Slashes In Url use Canonical Url or 301 Redirect?
          RyanKent
          RyanKent
          0
          7
          2.7k

        Get started with Moz Pro!

        Unlock the power of advanced SEO tools and data-driven insights.

        Start my free trial
        Products
        • Moz Pro
        • Moz Local
        • Moz API
        • Moz Data
        • STAT
        • Product Updates
        Moz Solutions
        • SMB Solutions
        • Agency Solutions
        • Enterprise Solutions
        • Digital Marketers
        Free SEO Tools
        • Domain Authority Checker
        • Link Explorer
        • Keyword Explorer
        • Competitive Research
        • Brand Authority Checker
        • Local Citation Checker
        • MozBar Extension
        • MozCast
        Resources
        • Blog
        • SEO Learning Center
        • Help Hub
        • Beginner's Guide to SEO
        • How-to Guides
        • Moz Academy
        • API Docs
        About Moz
        • About
        • Team
        • Careers
        • Contact
        Why Moz
        • Case Studies
        • Testimonials
        Get Involved
        • Become an Affiliate
        • MozCon
        • Webinars
        • Practical Marketer Series
        • MozPod
        Connect with us

        Contact the Help team

        Join our newsletter
        Moz logo
        © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
        • Accessibility
        • Terms of Use
        • Privacy