Quick Nav:  Online Store   |   Login | Register

Can't Get 301 to work

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
Stuart Hilbert
<50 Posts
Posts:23


08/20/2008 10:12 PM  

John,

I have read through the documentation and have looked at the forums, but for some reason I haven't been able to get a 301 redirect to work.  Perhaps, I am missing something wrong, or I am missing a step.

What I am expecting to happen is when I go to http://dummy.com or dummy.com then I should be redirected to http://www.dummy.com.   This isn't happening.

I am using the rule that I found in the forums which is as follows:

This is a Portal Rule.

Search for: /title>

Replace - Respond With:

[PB: IF(  Capture("[PB:Request.Url.Original]","http://([^/]+)[/]?(.*)" )  != ".dummy.com"  ) {

     [PB: Response.Status("301 Moved Permanently") ]
     [PB:Response.AddHeader("Location","http://www.dummy.com/$2")]
     [PB: Response.End() ]

} else{

/title>

}]

What am I missing?

Thanks,

Stuart

Stuart Hilbert
<50 Posts
Posts:23


08/21/2008 7:34 PM  
BUMPITY BUMPITY

Am I just missing something silly?

Thanks,
Stuart
John Mitchell
Posts:3471


08/21/2008 10:36 PM  
I can't see anything wrong with it. Are you sure the rule is running?

On the else part you can put the Original Url in a comment to see if it is just not matching.

} else{

/title>< !--[PB:Request.Url.Original] -->

}

On second look, I think you need to be checking for the www not being there since you want to go to www.

[PB: IF( Capture("[PB:Request.Url.Original]","http://([^/.]+)[/.]?(.*)" ) != "www." ) {
John Mitchell
Posts:3471


08/21/2008 10:56 PM  
if you use that last example you'll need to adjust the redirect to this:

[PB:Response.AddHeader("Location","http://www.$2")]
Stuart Hilbert
<50 Posts
Posts:23


08/25/2008 8:57 AM  

John,

I tried the items you suggested but to no avail.  I am beginning to think that the rules don't get kicked off at all.

I tried this rule from the pin forum post.

SearchFor:       (http[s]?://[^/]+)(/[^"]+)(/(?=tabid)[^"]+)/Default\.aspx(?!\?)

ReplaceWith:    $1$3$2.aspx

 

It doesn't work either. 

I have these rules setup under the Portal Rules, is that enough to get them to work?   From reading the manual my impression is that it is.  However, it doesn't seem to be doing the trick.

What is a fool proof way I can determine if my rules are running at all? Or again, am I missing something that I should be seeing?

Thanks,

Stuart

John Mitchell
Posts:3471


08/25/2008 9:14 AM  
One thing to check is to make sure you have a valid pro edition license by logging in as host and going to Admin>PageBlaster +Config

An easy rule I use to make sure portal rules are working is to SearchFor:Copyright ReplaceWith:PasteLeft

Not something you want to leave running but it is something that can be checked at the bottom of every page.
Stuart Hilbert
<50 Posts
Posts:23


08/25/2008 9:29 AM  

The license tells me it is valid for all settings.

I tried the copyright rule but that doesn't seem to execute either.

My assumption here is that anything under portal rules will run automatically is that correct? 

 






John Mitchell
Posts:3471


08/25/2008 9:57 AM  
Yes, that is correct.

Check to make sure that PageBlaster is enabled in web.config.
There should be a line in the httpModules section.

Also check to make sure that the Snapsis.PageBlaster.config is in the root of the website and that it doesn't have any exclusions that might stop the rule from executing.

You can then turn on trace logging by setting the trace node level="Debug".
Stuart Hilbert
<50 Posts
Posts:23


08/25/2008 11:02 AM  

PageBlaster is in the web.config in the HTTPModules Section.

I checked and the Snapsis.PageBlaster.config  does exist in the root of the site.

I went ahead and commented out all of the exclude paths just in Snapsis.PageBlaster.config  just in case that was the issue.  Still nothing.

I added the debug line to Snapsis.PageBlaster.config.  tracelevel="Debug"file-path="/PageBlaster.trace.webinfo" /> I restarted the Site, per the documenation.  I browsed around the site the file, PageBlasterTrace.webinfo is never created.  I did a standard asp.net trace and I can see in the cookies section that the saved rules folder for page blaster is being accessed.  Sorry to be such a pain, I really feel like I am just missing something simple.  Stuart

<

 

John Mitchell
Posts:3471


08/25/2008 11:09 AM  
If you have access to the server, maybe there is something in the server application or system event log.

Are cache files being created in the PageBlaster cache folder?
Stuart Hilbert
<50 Posts
Posts:23


08/25/2008 11:18 AM  

John,

I am doing this on my local computer trying to test my rules before deployment.  

Nothing is being created in the cache folder.

I am seeing these errors in the Application log on the computer

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/2/ROOT

Process ID: 10600

Exception: System.NullReferenceException

Message: Object reference not set to an instance of an object.

StackTrace: at Snapsis.HttpModules.PageBlaster.TraceWriter.WriteLine(String message, String category)

at Snapsis.HttpModules.PageBlaster.FolderCleanup.CleanFolders()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.runTryCode(Object userData)

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

John Mitchell
Posts:3471


08/26/2008 8:44 AM  

That is really strange.  There is very little in the WriteLine method that could possibly be null referenced.

Does your app pool for this site use more than one worker process?

Oh, I see that it is doing this from a CleanFolders process which happens in a separate thread, that may be a problem on initial start, but should be ok after.  Let me send you a debug version so we can get some more details, also see if you have any other errors, as I think this one is probably not related to the original problem.  This error only showed up because tracing was turned on.

Also, check to make sure there is write access to the PageBlaster cache folder.

 

John Mitchell
Posts:3471


08/26/2008 8:56 AM  

I have attached a debug version to this post.

I also made a change to make sure the PageBlaster TraceWriter is initialized in background folder cleanup.


Attachment: 182656579471.zip

Stuart Hilbert
<50 Posts
Posts:23


08/26/2008 10:21 AM  

John,

1. Installed new debug version.

2. Made sure Network Service has full permissions on all files in the site.

3. Rebooted computer just in case.

4. No longer getting Application error in Windows logs.

5. File PageBlaster.trace.webinfo isn't be created.

6. Still nothing in the Cache folder.

7. I did get two new DNN Event Host Alerts.

[script removed]
PageBlaster-DNNModuleControl: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.End() at System.Web.HttpResponse.Redirect(String url, Boolean endResponse) at Snapsis.DNN.PageBlaster.PageBlasterConfig.Page_Load(Object sender, EventArgs e)
Server Name: HILBERT
[script removed]
PageBlaster-DNNModuleControl: Thread was being aborted. at Snapsis.DNN.PageBlaster.PageBlasterConfig.Page_Load(Object sender, EventArgs e)
Server Name: HILBERT

John Mitchell
Posts:3471


08/27/2008 2:13 PM  

Are you using Vista with IIS7?  Not that it shouldn't work, I'm just trying to narrow things down at this point.

I don't know why there would be a redirect in the PageBlaster Configuration page load.  Does that happen every time?

Stuart Hilbert
<50 Posts
Posts:23


08/27/2008 3:12 PM  

Yep, Vista with IIS 7.

The only time I get the error is when I save the configuration for pageblaster.  From a GUI perspective it works but the error appears in the Event Log.

Stuart

John Mitchell
Posts:3471


08/27/2008 3:35 PM  
Oh right, a save and exit would create a redirect.

I'm just started using Vista with IIS7 myself, but i haven't debugged in this new environment.
Let me try stepping through and maybe I can figure out why it would do this.
Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
Forums >Snapsis Product Support >PageBlaster > Can't Get 301 to work



ActiveForums 3.7
Powered by: Snapsis Software