Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to redirect sitename.com to www.sitename.com (without 3rd party modules)?How to redirect sitename.com to www.sitename.com (without 3rd party modules)?
Previous
 
Next
New Post
4/5/2007 5:39 PM
 

Do you have the ability to setup another IIS website? you could setup a second site, one for http://sitename that just does a redirect to http://www.sitename

 


Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
4/5/2007 5:41 PM
 

 

What Chris says is the quick and easy way I have done it.

Here is a tutorial:

http://www.mcanerin.com/EN/articles/301-redirect-IIS.asp


DotNetNuke Modules from Snapsis.com
 
New Post
4/5/2007 6:23 PM
 

To clarify - I know how to set up DNS, host headers etc to get sitename.com to resolve to the same site as www.sitename.com. What I want to happen is for visitors who arrive at sitename.com to be redirected to www.sitename.com.

These sites are on a shared host and I don't have the ability to add another IIS site to act as a redirect. I was looking for a DNN based solution. It sounds like an HTTP Module is needed.

As an aside, can someone (John maybe!) explain why if the DNN site only has one portal alias of www.sitename.com, that sitename.com can still be used to navigate the site. I thought that one of the fundamental principles of DNN is that it only responds to requests where the sitename matched with a PortalAlias entry. For example, I have experienced many times navigating to one of my sites using a domain name with the right IP for IIS but which didn't match with a PortalAlias entry and getting redirected to one of the site names that is in PortalAlias.

 
New Post
4/5/2007 9:19 PM
 

 

Yes, as a matter of fact I can explain that.  In the core DNN code the www is removed when checking the Alias so that you do not need to have both entries.  In other words it is assumed that they are the same portal.

This discussion has led me to think that it may be beneficial to include this capability in PageBlaster.  So I'll be adding that feature soon.

If you want to do it now, you could place the code in a skin or the default.aspx page.

For SEO, the redirect should be a "301 Moved Permanently".  Here is the code you would need. (the word s c r i p t has spaces to make it post here in the forums).

< s c r i p t runat="server">
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
      If Not Request.Url.Host.ToLower().StartsWith("www") Then
        Response.Status = "301 Moved Permanently"
        Response.AddHeader("Location", Request.Url.Scheme & "://" & "www." & Request.Url.Host & Request.Url.PathAndQuery)
        Response.End
     End If
End Sub
< /s c r i p t >

I recommend putting it in the skin for the home page so it only works on the specific portal.

If you put this in the default.aspx page, then this will only work if you are not using other host names as the Portal Alias for different portals.

If you are using other portals with different host names then you could also make the code above be more specific.


DotNetNuke Modules from Snapsis.com
 
New Post
4/6/2007 2:27 AM
 

Would it work if I put this code on every page's skin?


 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to redirect sitename.com to www.sitename.com (without 3rd party modules)?How to redirect sitename.com to www.sitename.com (without 3rd party modules)?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out