Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Best way to rewrite a URL? Is there something built-in?Best way to rewrite a URL? Is there something built-in?
Previous
 
Next
New Post
7/12/2010 12:00 PM
 

Out of experience, our team has noticed subtle differences in results when using IIS7 vs IIS6, so just be mindful of that.


Shebang Websites - A product of Mogridge Design
Hey, we're partnered with UntangleMyWeb.com

 
New Post
7/12/2010 12:04 PM
 
Ok Jon, Thanks for the heads up. We'll probably be using IIS6 but I tested it on Friday using IIS7. I'll get a test site up on the server the site will be on and start from there.
 
New Post
7/12/2010 6:47 PM
 
Andrew Woomer wrote:
Jon Edwards wrote:

You should be able to do this with Ifinity's URL Master module.

Thanks Jon (and Rod)...I took a quick look at that on Friday and I saw where I could redirect to a different page but it didn't hold the URL as "p-1-Product-One.aspx" it changed it to "productdetail.aspx".

I'll have to set up a test site, roll up my sleeves, and really take a look at what URL Master can do.

 

Using iFinity URLMaster,I think you need to check the checkbox entitled "" and then specify a "-" as the space replacement character.  That will do what you're after.

Hope this helps,

Rod

 
New Post
7/12/2010 9:07 PM
 
Hi Guys

Just weighing in on the thread now.

The product urls you are looking at are obviously from a ASPDNSF install separate from DNN - am I correct?

It's not clear to me what you want to do : do you want to redirect away from the ASPDNSF site to the DNN site?

so, site1 : example.com/p-1-product-name.aspx should actually go to example.com/product-detail.aspx?

For a start, you'll have difficulties in getting DNN to work with the same domain name as a separate ASPDNSF install.  It's not impossible but will take some doing.   Assuming you're using a different domain name for the DNN site (example1.com), then what you want to do is to show the page details in your DNN page from the other format of Url.  That could be redirecting, or it could be rewriting.

Quote:


Can I use the SiteUrls.config file? I was able to redirect to the right page using this method but it swapped out the URL

<RewriterRule>
  <LookFor>.*a-123-this-is-a-test.aspx(.*)</LookFor>
  <SendTo>page.aspx</SendTo>
</RewriterRule>

It took the a-123-this-is-a-test.aspx that was in the link, redirected to the page I wanted it to, but didn't keep the a-123-this-is-a-test.aspx URL.


THis is not going to work.  Despite the 'sendto' format, this is a rewrite rule, not a redirect rule.  The standard DNN Url Rewriter cannot do 301 redirects.
There is no 'page.aspx' to rewrite the URl to.  DNN can only understand one type of Url (ok, there are a few exceptions, but they don't apply here).  The Url format that DNN works with is /default.aspx?tabid=xx.

So, if you want to rewrite  the Url from p-1-product-name.aspx to product-detail.aspx what you have to do is setup a rewriting rule that will find the Url, and then rewrite that to the correct tab id.  So instead of 'sendto' of page.aspx, your sendTo value will be /default.aspx?tabid=xx where xx is the tabid for 'page.aspx'.

That should rewrite OK and allow you to provide the content of that page for that Url.  You'll need to enter a Url for each separate product you want to support, and you'll have to create a one-to-one mapping of products in your system to DNN pages.   If that's starting to sound like a lot of work, it's because it's the wrong approach because it is extremly inflexible, and unless you have a small number of products that never change, will prove to be unworkable in practice.

The right approach is to display the content on a single DNN page using a module. If you are writing a custom module to display the products in DNN, then you'll need to do some more with the Url.  Specifically, you'll have to write a regex expressions that parses the 'a-1' into type=a&productId=1 in your Url.  I won't try that here because I'd probably get it wrong but it's pretty simple from a regex point of view.  You'll be rewriting to /default.aspx?tabid=xx&type=${type}&productid=${productid} or something like that.  Then, in your custom module, you'll be reading the querystring for type and productId and displaying the correct content (presumably reading from a database).  Note that this is all done with rewriting - no redirecting in sight here.  You'll also want to hide your page with the custom module from the menu so it doesn't get indexed with the standard Url.

Quote:

Using iFinity URLMaster,I think you need to check the checkbox entitled "" and then specify a "-" as the space replacement character.  That will do what you're after.

Rod is correct - this is how you put the hyphens into the Url, but the problem here is the confusion between redirects and rewriting. 

If you set up p-1-product-one.aspx as a redirect in Url Master, it will redirect the request to the specified page, which is what you're seeing.  You can effect the same thing by setting the status of the p-1-product-one URl in Url master to a '200' status, which will replace the Url for that page with p-1-product-one.aspx.  In effect the productdetail.aspx Url will be replaced with p-1-product-one.aspx everywhere - inclduing in the menu.  This is effectively the same thing as setting up a one-to-one mapping in the siteurls.config file for each product url with a product page (only much easier!). 

Url Master can also do custom rewriting of parameters in a similar way to the siteurls.config file if necessary.  But that's quite advanced and you'd need to get in contact with me via the website to set it up.   You might want to post here exactly how you want it to work including domain names (use fakes if necessary), how dynamic the product listings are, and how many there will be.  Those parameters will decide the best course of action for you.
 
New Post
7/12/2010 9:25 PM
 
Argh - quoting got me into format trouble - but you shoudl be able to glean the right parts from that post.
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Best way to rewrite a URL? Is there something built-in?Best way to rewrite a URL? Is there something built-in?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out