hiding extension from url

phalguni_mookhopadhayay
phalguni_mookhopadhayay used Ask the Experts™
on
in servlet

<web-app >
  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>test.HelloServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>

if we write url pattern to form action this will call the HelloServlet.
so there is no extension to the url. also for jsp there netui .
------------------------------------


how to implement it in php with out using .htaccess.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can use the explode function like

<?

$url = "test.HelloServlet";

$urlclass = explode(".",$url);

if(isset($urlclass[0])){
  echo $urlclass[0] // that will get the value of string prefix the .

}

?>

thanks

Kalpan
PHP is a scripting language. The only way you can achieve this is to use .htaccess and the Apache rewriting engine http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial