skip to Main Content

I want covert aspx page into html at runtime for SEO.

like example
localhost:45556/index.aspx => localhost:45556/index.html

3

Answers


  1. Google wouldn’t care if it’s aspx or html. The more important part is that the domain name tells something about what the site is about, and the URL path tells something about the page you are on.

    http://www.domain.com/shirts/tshirts/green/ is a better URL than http://www.domain.com/prodId=3999944

    Login or Signup to reply.
  2. You could use the IIS Rewrite Module like described in this post:

    Remove HTML or ASPX Extension

    and change the match URl criteria to

    <match url="(.*).html" />
    

    and change the action to the following

    <action type="Rewrite" url="{R:1}.html" />
    
    Login or Signup to reply.
  3. You can do this in c#.NET to change the .aspx to .html

    Please put this code in your Global.asax file.

    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        HttpApplication app = sender as HttpApplication;
        if (app.Request.Path.ToLower().IndexOf(".html") > 0)
        {
            string rawpath = app.Request.Path;
            string path = rawpath.Substring(0, rawpath.IndexOf(".recon"));
            app.Context.RewritePath(path+".aspx");
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search