Hiding the .JSP extension using mod_write module

Discussion in 'Java' started by Ed, Nov 2, 2006.

  1. Ed

    Ed Guest

    Hi All,

    I would like to hide the extension of my jsp page.

    My correct URL is this one, with a .JSP extension:

    http://localhost/Web/view.jsp?keyname=name&keynumber=number


    But I would like the End-USer to use the following URL with .ASP
    extension, on the internet browser, and once she/he does, it's going to
    be redicted to the .JSP extension, on the fly!

    http://localhost/Web/view.asp?keyname=name&keynumber=number



    Could you anyone tell me what I am doing wrong below, with the
    mod_rewrite module in my Apache's http.conf file?



    <VirtualHost *:80>

    RewriteEngine on
    RewriteRule ^(.*)\.asp$ $1.jsp [L]

    </VirtualHost>



    Thanks!
     
    Ed, Nov 2, 2006
    #1
    1. Advertising

  2. Ed

    shimmyshack Guest

    not much really just change [L] to be [L,QSA] (for query string append)

    if you go one stage further you get the benefit of hiding the
    technology and using apache to perform regular expressions on your
    query string args, as well as being search engine friendly.

    Wordpress has a great .htaccess file (complex but real world) which
    shows very nicely how to completely change a complex site from urls of
    the form

    http://host/web/variable/path/to/bits/of/app/dynpage.tech?var1=arg1&var2=arg2&var3=arg3

    http://host/web/variable/path/to/bits/of/app/dynpage/arg1/arg2/arg3

    just grab the tar.gz and extract the htaccess file.


    Ed wrote:
    > Hi All,
    >
    > I would like to hide the extension of my jsp page.
    >
    > My correct URL is this one, with a .JSP extension:
    >
    > http://localhost/Web/view.jsp?keyname=name&keynumber=number
    >
    >
    > But I would like the End-USer to use the following URL with .ASP
    > extension, on the internet browser, and once she/he does, it's going to
    > be redicted to the .JSP extension, on the fly!
    >
    > http://localhost/Web/view.asp?keyname=name&keynumber=number
    >
    >
    >
    > Could you anyone tell me what I am doing wrong below, with the
    > mod_rewrite module in my Apache's http.conf file?
    >
    >
    >
    > <VirtualHost *:80>
    >
    > RewriteEngine on
    > RewriteRule ^(.*)\.asp$ $1.jsp [L]
    >
    > </VirtualHost>
    >
    >
    >
    > Thanks!
     
    shimmyshack, Nov 3, 2006
    #2
    1. Advertising

  3. Ed

    Ed Guest

    shimmyshack wrote:
    > not much really just change [L] to be [L,QSA] (for query string append)
    >
    > if you go one stage further you get the benefit of hiding the
    > technology and using apache to perform regular expressions on your
    > query string args, as well as being search engine friendly.
    >
    > Wordpress has a great .htaccess file (complex but real world) which
    > shows very nicely how to completely change a complex site from urls of
    > the form
    >
    > http://host/web/variable/path/to/bits/of/app/dynpage.tech?var1=arg1&var2=arg2&var3=arg3
    >
    > http://host/web/variable/path/to/bits/of/app/dynpage/arg1/arg2/arg3
    >
    > just grab the tar.gz and extract the htaccess file.
    >
    >
    > Ed wrote:
    > > Hi All,
    > >
    > > I would like to hide the extension of my jsp page.
    > >
    > > My correct URL is this one, with a .JSP extension:
    > >
    > > http://localhost/Web/view.jsp?keyname=name&keynumber=number
    > >
    > >
    > > But I would like the End-USer to use the following URL with .ASP
    > > extension, on the internet browser, and once she/he does, it's going to
    > > be redicted to the .JSP extension, on the fly!
    > >
    > > http://localhost/Web/view.asp?keyname=name&keynumber=number
    > >
    > >
    > >
    > > Could you anyone tell me what I am doing wrong below, with the
    > > mod_rewrite module in my Apache's http.conf file?
    > >
    > >
    > >
    > > <VirtualHost *:80>
    > >
    > > RewriteEngine on
    > > RewriteRule ^(.*)\.asp$ $1.jsp [L]
    > >
    > > </VirtualHost>
    > >
    > >
    > >
    > > Thanks!


    Hi shimmyshack,

    Thanks for the info! I will try and see if your suggestion resolves my
    problem!
     
    Ed, Nov 4, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    4,598
  2. Anand
    Replies:
    3
    Views:
    922
    Tim Daneliuk
    Nov 8, 2003
  3. Floris Bruynooghe
    Replies:
    1
    Views:
    365
    Floris Bruynooghe
    Dec 24, 2008
  4. Dave Lee
    Replies:
    4
    Views:
    185
    Dave Lee
    Apr 12, 2005
  5. Ste
    Replies:
    41
    Views:
    863
    Thomas 'PointedEars' Lahn
    Aug 1, 2007
Loading...

Share This Page