logo
Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
bart  
#1 Posted : Monday, October 14, 2013 2:30:27 PM(UTC)
bart

Rank: Administration

Reputation:

Groups: Administration
Joined: 10/8/2008(UTC)
Posts: 188
Man

Was thanked: 1 time(s) in 1 post(s)
Hi,

A common problem in Sienn is that when someone enters the url without the www and including the specefic path he or she will end up with some kind of 404 error because the default page doesn't handle those specific path's well.

for instance http://sienn.com/support.html is not the same as http://www.sienn.com/support.html
To resolve this problem and let http://sienn.com/support.html reroute to http://www.sienn.com/support.html you can do the following
you have to add the domain sienn.com (without www) as a hostheader to the specific domain.

now you can go to http://sienn.com/support.htm but you won't be redirected which means double content which isn't good for goolge indexing
so to forward to the www you can add this source to "Userescape global parameters"
Code:

dim werkurl as string = "sienn.com"
dim liveurl as string = "www.sienn.com"

dim volledigeurl as string = Request.Url.AbsoluteUri.ToString
dim Scheme as string = Request.Url.Scheme.ToString
dim currenturl as string = Request.Url.Host.Tostring
dim PathAndQuery as string = Request.Url.PathAndQuery.ToString
dim needstoberelocated as boolean = false
dim Cid as string = pbw.Get_Cid_currentdomain


dim URLREWRITINGTEXT as string 
try
  URLREWRITINGTEXT =  pbw.Get_Config_Value(CID,0,"URLREWRITINGTEXT",constring)
catch
  URLREWRITINGTEXT = "Nee"
end try  

if currenturl = werkurl then
  if URLREWRITINGTEXT = "Ja" then
    Dim rewr as string = Pbw.Replace_TextUrl_WithRewriting(0, "/","<a href=""" & PathAndQuery & """>tmplink</a>", Cid, ConString)
      if rewr.length>0 then
        PathAndQuery= rewr
        PathAndQuery = PathAndQuery.replace("<a href=""","")
        PathAndQuery = PathAndQuery.replace(""">tmplink</a>","")
    end if
  end if
  
  currenturl = currenturl.replace(werkurl,liveurl)
  volledigeurl = Scheme & "://" & currenturl & PathAndQuery
  needstoberelocated = true
  
end if

'redirect 301 (permanently)
if needstoberelocated = true then
  Response.Status = "301 Moved Permanently"
  Response.AddHeader("Location",volledigeurl) 
end if


you can of course do some modifications to this script so every domain execpt from www.sienn.com wil be redirected or you can obtain the default website using another function.

I hope this will help some of you.

BTW. we did not apply this solution to the mentioned website, for this site we used an older script

Wanna join the discussion?! Login to your Sienn Forum forum account. New Registrations are disabled.

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.