Quick Nav:  Online Store   |   Login | Register

URL redirect

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
Charles Rowland
<50 Posts
Posts:39


07/29/2008 10:25 AM  

Hi John,

Is there a place with examples of how to use the 'Saved Rules'? I am trying to use your 301 redirect to replace an underscore with a dash. Using this just blanks out ALL my pages. What am I missing?

. (note the period in the search box)

[PB: IF( Match("[PB:Request.Url]","http://www.goldenhillsrealty.com/about_us/testimonials.aspx") ) {

    [PB: Response.Status("301 Moved Permanently") ]

    [PB: Response.AddHeader("Location","http://www.goldenhillsrealty.com/about-us/testimonials.aspx") ]

    [PB: Response.End() ]

} ]

Thank you,

Charlie

 

John Mitchell
Posts:3471


07/29/2008 11:10 AM  

Don't search for a period, search for something unique that can be replaced if the match fails.

Something like:  /title>

 

John Mitchell
Posts:3471


07/29/2008 11:14 AM  

BTW, if you have several 301 redirects to do then I have a better way with a newer version of PageBlaster (not yet released).

It allows you put all of your redirects in the ResourceLocationTable.config file in a more logical way then doing a search and replace operation.

Charles Rowland
<50 Posts
Posts:39


07/29/2008 11:22 AM  
I just have 4 or 5 that got picked up by Google before I changed them. The new way sounds more convienient, though.

If I use /title> don't I need that in the replace somewhere to replace it?

Thank you,

Charlie
John Mitchell
Posts:3471


07/29/2008 12:00 PM  

Yes, you should have an } else { condition that replaces the searched for text.

This thread explains it better:

301 Redirects using PageBlaster Replacement Rules

I have also attached the latest DLL and a sample ResourceLocationTable.config file if you want to try out the new method.

Your ResourceLocationTable.config file may already have entries from other virtual paths, they do not need to be changed. It is located in the DesktopModules/Snapsis/PageBlaster/Config folder.


Attachment: 172904469271.zip

Charles Rowland
<50 Posts
Posts:39


07/29/2008 12:19 PM  
Thanks John! The example in that thread is perfect.
Charles Rowland
<50 Posts
Posts:39


07/29/2008 1:11 PM  

Ok, I must be missing something... Shouldn't this work? When I try to go to the old url I get a 404 error.

Search for:
(/head with backets)
Replace with:
[PB: IF( Match("[PB:Request.Url]","http://www.goldenhillsrealty.com/about_us/our_team.aspx") ) {

[PB: Response.Status("301 Moved Permanently") ]

[PB: Response.AddHeader("Location","http://www.goldenhillsrealty.com/about-us/our-team.aspx") ]

[PB: Response.End() ]

}
else{
(/head with backets)

} ]

 
 

Charles Rowland
<50 Posts
Posts:39


07/29/2008 1:19 PM  
Request.Url is not in your list of tokens. Is this an issue?
John Mitchell
Posts:3471


07/29/2008 1:44 PM  
Request.Url should be there, maybe I missed it, but I have since added Request.OriginalUrl which may work better in this case. OrginalUrl will make sure it uses what is entered on the address bar of the browser in case it is rewritten internally by DNN.
John Mitchell
Posts:3471


07/29/2008 1:47 PM  
If the about_us link no longer exists then you will need to use the new method of updating the ResourceLocationTable.config file.
That was another drawback of redirecting from an old page since the old page had to still be there for the rule to be executed.
Charles Rowland
<50 Posts
Posts:39


07/29/2008 1:47 PM  
Still gives me a 404 error. This is supposed to redirect me to the new page if I enter the old url in the address, right?
Charles Rowland
<50 Posts
Posts:39


07/29/2008 1:50 PM  

Ok, that explains it. The old url does not exist.

In the file you sent is the following which seems to redirect one url to a second and then that to another. Can you give me an example of what it should like like with my page? Sorry, this is missing half the data....

url="/Forums.aspx"
method="PermanentRedirect" isPattern="False" />
url="/default.aspx?tabid=69"
method="Rewrite" isPattern="False" />

John Mitchell
Posts:3471


07/29/2008 2:17 PM  
You only need one to do a 301 redirect, the other example is a Rewrite.

For yours you would enter :

virtual-path="/about_us/our_team.aspx"
url="/about-us/our-team.aspx"
method="PermanentRedirect" isPattern="False" />
Charles Rowland
<50 Posts
Posts:39


07/29/2008 2:34 PM  
This worked perfectly! Thank you very much!
Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.



ActiveForums 3.7
Powered by: Snapsis Software