Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

301 Redirect for multiple host names

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
John Mitchell
Posts:3479



04/05/2007 8:21 PM  

You may have your site working with and without the www in front.  For SEO purposes you may also want to make sure that it is not counted as duplicate content.

For SEO, the redirect should be a "301 Moved Permanently".  Here is the code you would need.

< script runat="server">
PrivateSub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.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
EndSub

< /script>

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.

 

LEADTOOLS
Posts:28



05/08/2007 10:20 AM  
301 redirection is something I need to learn how to implement. I am glad this post is here, but I'm a bit new to ASP (I've done more work with PHP in the past). If you have time I need a little help interpreting this code. Pardon my ignorance but I'm not certain where the reference to the new page is occurring. Say I have the following pages to be redirected:

www.mywebsite.com/myfirstpage.htm > www.mywebsite.com/myfirstpage/tabid/141/Default.aspx
www.mywebsite.com/mysecondpage.htm > www.mywebsite.com/mysecondpage/tabid/141/Default.aspx

How would this be implemented? Do you (or anyone that you know) make a module to handle this as a 301 redirect?

Thank you,

Shane
John Mitchell
Posts:3479



05/08/2007 5:26 PM  

Hi Shane,

There are many answers to this question so bear with me.

If you are wanting to re-direct from a .HTM extension then you would need to assign that extension to ASP.Net to get a DNN module to recognize it.  This is not the most optimal thing to do but it is possible.

If you have control of the server and you want to keep from mapping .htm files to the ASP.Net pipeline you can use an ISAPI filter.

http://www.isapirewrite.com/  is a good one for this purpose that gives you all the flexibility of the Apache mod-rewrite.

In IIS7 Microsoft has taken us closer to the Apache world and is making it possible for developers to plug-in ASP.Net HttpModules to the IIS system.  What this means is that you won't need to have control of the server to do what the ISAPI Rewrite filter does now.

Ok, back to the code above.  It is something that you can paste into an ASP.Net page (.aspx), or an ASP.Net User Control (.ascx).
The main drawback is that it will not work with .htm extensions unless the Asp.net application mapping mentioned earlier is configured in IIS.

Last, but certainly not least, my PageBlaster module will have this functionality in the near future.

LEADTOOLS
Posts:28



05/09/2007 8:30 AM  
Hehe, I know this is a dreaded question, but by "near future", is there anything more specific?  We are wanting to launch pretty soon.  To be a little more specific, I notice they have a "free 30 day trial".  Do you think your module would be finished before the end of that time period if we installed the software in the next couple of days?  I don't think management would be averse to paying for both, it would just be a little nicer of course if we only paid for the final solution.  I like the quality of your support and my experience with your modules, so I would rather go with yours.

Shane
John Mitchell
Posts:3479



05/09/2007 5:26 PM  

Unfortunately my "near future" usually turns out to be more than 30 days.

Do you have access to change your website settings in IIS so that you can have virtual page names with an HTM extension be handled by ASP.Net? If so, then the current version of PageBlaster can handle delivering your pages without doing a 301 redirect. You can give them virtual names like myfirstpage.htm and the content delivered could be from the new DotNetNuke page automatically.

LEADTOOLS
Posts:28



05/10/2007 2:41 PM  
I'm afraid I don't know how to do that, but I *do* have remote desktop (as well as physical) access to the server. Do you have a link to some instructions on how to set this up?
John Mitchell
Posts:3479



05/10/2007 4:10 PM  

 Asp.net application mapping has the procedure, but it is for a wildcard mapping.  All you really need is to add a mapping to .htm files if you want to use that extension.

 

 

schotman
Posts:17



05/23/2007 2:39 PM  

We use a module DS-trafficDirector. It is nice for multiple domainnames to the same content.

Peter


Peter Schotman
DotNetNuke professional
Cestus Websites
Arnhem, Gelderland, The Netherlands
russback
Posts:1



06/27/2008 1:31 AM  

Hi - like the the look of this but I have a question...

Is there any way to redirect using the whole URL? When I use this script to redirect this:

http://mysite.com/gff/FitnessCoursesCatalogue/FitnessInstructorCourses/Level2CertificateinFitnessInstructingExerc/tabid/131/Default.asp

I want to achieve this:

http://www.mysite.com/gff/FitnessCoursesCatalogue/FitnessInstructorCourses/Level2CertificateinFitnessInstructingExerc/tabid/131/Default.asp

But what I actually get is this:

http://www.mysite.com/Default.asp?TabId=131

Thanks

 

krebes
Posts:2



09/09/2008 3:22 PM  

John,

I need some clarification for my scenario which I have had very difficult time finding an answer anywhere else!

I have DNN instance installed and running in /DNN directory.
My host provider does not allow domain forwarding or redirects to subdirectories directly--which may not matter...)
I have three sites I want to launch ASAP! I am new to DNN.

But I found CataLook.net stores module that supports a multi-store environment that allows store owners to share vendor's offerings or feature each other's products across the stores...

I've read some of the feedback and posts regarding your latest PageBlaster product... most seems favorable, but there was some concerns raised by a CataLook Store/DNN store user who ran into some trouble with PageBlaster... was this ever resolved to their satifaction?

Now back to the main question:

I want to use CataLook for 2 of the 3 sites--each as a parent portal. For eg., PrintStoreA.com needs to go to portal x AND PrintStoreB.com needs to go to portal y. If this works, then we hope to expand this offering to any number of small to large print shops to enable online commerce.

The third site is just a DNN site, for eg., SomeSite.com that needs to go to DNN portal z...

The host site is a 4th site that I am trying to pigyback for the hosting (my4thsite.com). Ideally, I would implement a solution that would all to function properly.

Last wrinkle is that my domains are all registered at GoDaddy.

My current ASP.Net v2 hosting provider, for extra one-time fee, permits set-up of domain pointer, but it only allows domain redirects to the root folder (my4thsite.com) and prohibits redirects/rewrites to subdirectories...

Believe it or not, this problem has stumped me for a couple of weeks and I would bail from anything to do with DNN except for the CataLook offering.

Can you offer any specific scripts/solutions to handle the above? Please advise. I saw you post at

http://www.snapsis.com/DotNetNuke/Support/tabid/560/forumid/12/postid/5428/view/topic/301-Redirect-for-multiple-host-names.aspx

and it was not clear what would need to be changed to implement correctly for my above 4 sites.

I have no problem buying PageBlaster now, but it seems like overkill initially! Only because if I can't get to first base with a basic redirect/rewrite, etc., then I'll have to bail on DNN.

Thanks, in advance, for your assistance!

Krebes

lynngrin
Posts:95



09/09/2008 5:36 PM  

Hi John

You might find the information contained below useful.

http://duhnetnuke3.net/DNN3PortalSetup/AddanHTTPAlias/tabid/110/Default.aspx


www.drivewaydesign.eu For A Dream Driveway

www.a2zdom.com Domain name matters


krebes
Posts:2



09/09/2008 5:41 PM  

John,

I need some clarification for my scenario which I have had very difficult time finding an answer anywhere else!

I have DNN instance installed and running in /DNN directory.
My host provider does not allow domain forwarding or redirects to subdirectories directly--which may not matter...)
I have three sites I want to launch ASAP! I am new to DNN.

But I found CataLook.net stores module that supports a multi-store environment that allows store owners to share vendor's offerings or feature each other's products across the stores...

I've read some of the feedback and posts regarding your latest PageBlaster product... most seems favorable, but there was some concerns raised by a CataLook Store/DNN store user who ran into some trouble with PageBlaster... was this ever resolved to their satifaction?

Now back to the main question:

I want to use CataLook for 2 of the 3 sites--each as a parent portal. For eg., PrintStoreA.com needs to go to portal x AND PrintStoreB.com needs to go to portal y. If this works, then we hope to expand this offering to any number of small to large print shops to enable online commerce.

The third site is just a DNN site, for eg., SomeSite.com that needs to go to DNN portal z...

The host site is a 4th site that I am trying to pigyback for the hosting (my4thsite.com). Ideally, I would implement a solution that would all to function properly.

Last wrinkle is that my domains are all registered at GoDaddy.

My current ASP.Net v2 hosting provider, for extra one-time fee, permits set-up of domain pointer, but it only allows domain redirects to the root folder (my4thsite.com) and prohibits redirects/rewrites to subdirectories...

Believe it or not, this problem has stumped me for a couple of weeks and I would bail from anything to do with DNN except for the CataLook offering.

Can you offer any specific scripts/solutions to handle the above? Please advise. I saw you post at

http://www.snapsis.com/DotNetNuke/Support/tabid/560/forumid/12/postid/5428/view/topic/301-Redirect-for-multiple-host-names.aspx

and it was not clear what would need to be changed to implement correctly for my above 4 sites.

I have no problem buying PageBlaster now, but it seems like overkill initially! Only because if I can't get to first base with a basic redirect/rewrite, etc., then I'll have to bail on DNN.

Thanks, in advance, for your assistance!

Krebes

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

Forums >DotNetNuke Support >Tips-And-Tricks > 301 Redirect for multiple host names



ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 Performance for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information 
XDAkuna (Web 2.0 CSS XHTML Skin)

Item codeXDAkuna
AuthorNina Meiers
Price$49.00
Product Information 
XDAkuna (Web 2.0 CSS XHTML Skin)

AuthorNina Meiers
Price$49.00
Product Information