big problame. please help

Discussion in 'Programming' started by surekhaweb, Aug 25, 2008.

  1. #1
    i try lots of but not finding proper solution.

    i want to redirect url query sting to .html page

    for example

    my url is www.mysite.com/page1.aspx?id=2

    now i want to convert this url in to www.mysite.com/page1.html

    i hope it is possible .

    but i don't want to use javascript and sql server

    my hosting server is windows base.

    i use XML as a databse.

    also i use asp.net

    please help me
     
    surekhaweb, Aug 25, 2008 IP
  2. CarcaBot

    CarcaBot Active Member

    Messages:
    389
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #2
    use htaccess :


    
    Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^page.html page1.aspx?id=$1 
    RewriteRule ^(.*).html page1.aspx?id=$1 
    
    PHP:
    it shod work fine ...!
     
    CarcaBot, Aug 25, 2008 IP
  3. muncle

    muncle Guest

    Messages:
    1,195
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm by no means a server expert, but something is telling me this is an Apache thing that may not work on windows servers
     
    muncle, Aug 25, 2008 IP
  4. CarcaBot

    CarcaBot Active Member

    Messages:
    389
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #4
    depend on what he is using : IIS or apache !
    he can isntall : ISAPI Rewrite 2.0/3.0 for IIS it do the samre thing as htaccess~
    The rewrite file look somthing lyke this:

    
    [ISAPI_Rewrite]
    # fix missing slash on folders
    # note, this assumes we have no folders with periods!
    RewriteCond Host: (.*)
    RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [RP]
    
    # remove index pages from URLs
    RewriteRule (.*)/default.htm$ $1/ [I,RP]
    RewriteRule (.*)/default.aspx$ $1/ [I,RP]
    RewriteRule (.*)/index.htm$ $1/ [I,RP]
    RewriteRule (.*)/index.html$ $1/ [I,RP]
    
    # force proper www. prefix on all requests
    RewriteCond %HTTP_HOST ^test\.com [I]
    RewriteRule ^/(.*) http://www.test.com/$1 [RP]
    
    # only allow whitelisted referers to hotlink images
    RewriteCond Referer: (?!http://(?:www\.good\.com|www\.better\.com)).+
    RewriteRule .*\.(?:gif|jpg|jpeg|png) /images/block.jpg [I,O]
    
    PHP:
    or he can isntall apache server on windows server and then he can use htacces |!
     
    CarcaBot, Aug 25, 2008 IP
  5. eponus

    eponus Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    He said he's running ASP.NET which means he has to use IIS instead of Apache, which means mod_rewrite won't work.
     
    eponus, Aug 25, 2008 IP
  6. surekhaweb

    surekhaweb Banned

    Messages:
    504
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    so what can i do?
     
    surekhaweb, Aug 25, 2008 IP
  7. CarcaBot

    CarcaBot Active Member

    Messages:
    389
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #7
    try to instal : ISAPI Rewrite Version 2.0 or 3.0 for IIS !
    And u shod not have problems ...!
     
    CarcaBot, Aug 25, 2008 IP
  8. maestria

    maestria Well-Known Member

    Messages:
    705
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #8
    Hi,

    You can redirect changing the header.
    Location : Header :domain name something of that sort.
    I am not sure about the exact syntax, but there is such a fascility in every programming language.
     
    maestria, Aug 26, 2008 IP
  9. surekhaweb

    surekhaweb Banned

    Messages:
    504
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    ok finally i get the solution of convert

    www . mysite . com/page1.aspx?id=2

    to

    www . mysite . com/page1.html

    no i have other question.

    now google already index my www . mysite . com/page1.aspx?id=2 pages

    now i want to deindex (remove from index) this page and replace with www . mysite . com/page1.html

    how can i do this.or is it automatically replace when google again crawling this page?
     
    surekhaweb, Sep 2, 2008 IP
  10. surekhaweb

    surekhaweb Banned

    Messages:
    504
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    i want to Use 301 redirect

    how i can redirect all the old pages to the new ones via just new lines of code.
     
    surekhaweb, Sep 2, 2008 IP