View Full Version : Hello. Absolutely New here. Dumb noob needs 301 redirect help.

01-08-2007, 06:47 PM
Hello everyone. I found these forums looking when the other forums where just not paying attention to me. What I found is that you guys actually communicate, if at least to say, "I don't no, but you can try this"

In any case, here's my problem.

I have a website running an asp.net 1.1 e-commerce solution in the root. This application has no room for content management, so a created a sub-folder called more/, and installed a CMS called DotNetNuke.

I've decided to move to a different application, for performance purposes, and for web search purposes as well. I know how to do a redirect in asp.net, so I figured that I'd do it hardball style and actually create folders and pages that corresponded to the originals, and just pop in a 301 redirect to the new application pages, as they corresponded.

In other words, those DNN pages that had a url of more/HelpFAQ/tabid/56/Default.aspx, as was going to create a folder called 56, inside of a folder called tabid, inside of a folder called HelpFAQ, and stick a default.aspx page in there with a 301 redirect to the new url and corresponding page.

I know, this method might seem very dumb, but easy to understand and easy to implement.

However, my dnn application has some other, WEIRD urls. For instance


In bold, you can see that heres a url that looks like there is a folder with no name. You can't do that.

I was hoping to find an asp.net script, preferably VB 1.1, that will do the following.

just one default.aspx page in the more/ folder, with an argument that says

If uri = more/HelpFAQ/tabid/56/Default.aspx
Then 301 redirect to (new page)

If uri - more//OutdoorFabrics/whatever/default.aspx
Then 301 redirect to (new page)

I found this code:

If InStr(Request.Url.AbsoluteUri, "www") = 0 Then
Response.Status = "301 Moved Permanently";
Response.AddHeader("http://www.yoursite.com" & Request.RawUrl)
End If

So I'm wondering if I could use it like this

If InStr(Request.Url.AbsoluteUri, "www") = http://www.cushionsandumbrellas.com/more//OutdoorFabrics/SuggestedFabricCombinations/tabid/54/AlbumID/417-5/Default.aspx

Response.Status = "301 Moved Permanently";
Response.AddHeader("http://articles.cushionsandumbrellas.com/outdoor-fabric-417.aspx" & Request.RawUrl)
End If

Any help would be appreciated.

01-08-2007, 10:26 PM
No; InStr() returns an index, not a string.
So this won't work.

If InStr(Request.Url.AbsoluteUri, "www") = http://www.cushionsandumbrellas.com/...5/Default.aspx

Actually, I can't tell what you even wanted that to be. :D

Were you trying to compare the URL to a specific string, or ?

01-09-2007, 09:03 AM
Were you trying to compare the URL to a specific string, or ?

No, not a string, but the url of an incoming request.

I guess I gummed up the explanation. I'm sorry.

I'm trying not to spam these forums, but I need to post some url's for example.


These are some examples of the urls that I'm talking about. They are the product of a url rewrite from within DotNetNuke. However, they are not too "friendly" really, and I'm going to use a new web app that does create SE and People friendly urls.

Like I said, what I was going to do was create an actual folder structure within the more/ folder that would mimic what these "friendly" urls look like. Inside of each, I would place an empty default.aspx file, with a 301 redirect code to the new page.

I now, hardball, but quick and dirty.

However, because of certain urls, like

I've got a problem. That double slash behind the more folder, I can't create an no name folder.

So, I was hoping that I can create just one default.aspx file in the more/ directory, and use an argument for each possible url, only about 30, to 301 redirect those urls to the new page. The urls would be treated like static urls.

As you noted, the code I found would not do this. I was hoping that someone would know of a way or describe how I could create this argument. I am not a coder by nature, I just string together pieces of code that will have the desired affect.

Thank you very much.

01-09-2007, 03:26 PM
Correct me if I'm wrong, but it seems you want to redirect every one of the URLs that have those double slashes to one specific page, right?

If so I think this might work.

If InStr(Request.Url.AbsoluteUri, "//") > 0 Then
Response.Status = "301 Moved Permanently";
End If

01-09-2007, 10:04 PM
Sounds right.

So, if I create one default.aspx file in the /more directory, and insert in the code behind

If InStr(Request.Url.AbsoluteUri, "//") > 0 Then
Response.Status = "301 Moved Permanently";
End If

all of the pages with the double slash should 301 redirect to the specified url?

01-09-2007, 10:34 PM
Honestly, I have no clue. :)

Assuming the request uri did in fact have double slashes, works in theory. :D
How the request uri ends up with double slashes by the time default is hit, I have no idea. I've never done redirects like this.