Umbraco website creation (8) Implement pseudo-static

Source: Internet
Author: User
Tags umbraco

To put it bluntly, it is URL rewriting. Why do we mention this? Although pseudo-static data is not really static, it is not without its advantages.

Next I will talk about the application in Umbraco ~!

We all know that URLRewriter is used for implementation. First, in Umbraco, we do not need to download it again because it already comes with it.

We can open the \ bin directory and we can see that UrlRewritingNet. UrlRewriter. dll is his own. Almost all cultivation files have been written. All we have to do is modify them as needed.

Then the results are displayed.

Go to the config folder in the project directory, find the UrlRewriting. config file, and use NotePad to open it.

 

<Urlrewritingnet xmlns = "http://www.urlrewriting.net/schemas/config/2006/07">
<Rewrites>
<! --
Urlrewriting. Net is a cool tool, what can make your urls look nice.
The rewriting is controlled with regular expressions. To get more help
Look at http://www.urlrewriting.net /.

Remember to read the manual!
Http://www.urlrewriting.net/download/UrlRewritingNet20.English.pdf

The sample below rewrites a url from
"/Product/someproductid. aspx"
"/Product. aspx? Productid = someproductid"

The user will not see the rewritten path! The page that will be
Loaded from umbraco will instead be:
"/Product. aspx? Productid = someproductid"

<Add name = "produktidrewrite"
VirtualUrl = "^ ~ /Product/(. *). aspx"
RewriteUrlParameter = "ExcludeFromClientQueryString"
DestinationUrl = "~ /Product. aspx? Productid = $1"
IgnoreCase = "true"/>

This sample is usefull for a productpage, where the product comes from
Dynamic datasource, e.g. a database. The querystring "productid" can be loaded
From the template, into a macro, that then loads the product!

Any bugs or problems with the rewriter, contact Anders/Duckie
-->
</Rewrites>
</Urlrewritingnet>

 

 

You will find that he has written a good note, but it is useless. We can modify it as needed.

 

 

<Urlrewritingnet xmlns = "http://www.urlrewriting.net/schemas/config/2006/07">
<Rewrites>
<! --
Urlrewriting. Net is a cool tool, what can make your urls look nice.
The rewriting is controlled with regular expressions. To get more help
Look at http://www.urlrewriting.net /.

Remember to read the manual!
Http://www.urlrewriting.net/download/UrlRewritingNet20.English.pdf

The sample below rewrites a url from
"/Product/someproductid. aspx"
"/Product. aspx? Productid = someproductid"

The user will not see the rewritten path! The page that will be
Loaded from umbraco will instead be:
"/Product. aspx? Productid = someproductid "-->

<Add name = "about" virtualUrl = "~ /About.html "destinationUrl = "~ /About. aspx "/>
<Add name = "down" virtualUrl = "~ /Down.html "destinationUrl = "~ /Down. aspx "/>

<! -- This sample is usefull for a productpage, where the product comes from
Dynamic datasource, e.g. a database. The querystring "productid" can be loaded
From the template, into a macro, that then loads the product!

Any bugs or problems with the rewriter, contact Anders/Duckie
-->
</Rewrites>
</Urlrewritingnet>

Here, we can see that the file we created is the end of the. aspxfile. We want to change the suffix to the end of the. html file.

Above ~ /About. aspx is my actual file path, and ~ /About.html is my modified path. With this sentence, both paths can access my real path ~ /About. aspx

 

The reason for doing so is that SEO can better capture our pages.

 

This step does not work. Now we open the IIS server

Right-click our project and choose Properties> Home directory> Configuration>

Here we create an extension named .html. the executable file C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_isapi.dll is the same as that of. aspx.

Note: You must remove the check box for whether the file exists.

OK;

In this case, we can access our page through the. html suffix ~!

 

 

Now I have finished the Umbraco article. There are still many things worth studying, but at present I have learned so much and hope that all my friends will study and communicate with each other.

Let's share some good things.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.