Hiding the .JSP extension using mod_write module

E

Ed

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!
 
S

shimmyshack

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.
 
E

Ed

shimmyshack said:
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.

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top