比如你使用Tomcat
1.去掉端口号:
在server.xml中把Http端口改成80,因为浏览器默认使用80端口,如:<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443"/>
2.去掉工程名:
在server.xml中加入如下context设置(假设你的Tomcat在C:\Java\apache-tomcat-6.0.18,工程名为test):
<Context docBase="C:\Java\apache-tomcat-6.0.18\webapps\test" path="" reloadable="true" /></Host>
其中的docBase为找到工程的路径,path就是你的工程context,这里什么也不写。如果你写成"hello",那么此时你的访问路径就是:http://localhost/hello,这里什么也没写,所以访问路径是:http://localhost
1.去掉端口号:
在server.xml中把Http端口改成80,因为浏览器默认使用80端口,如:<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443"/>
2.去掉工程名:
在server.xml中加入如下context设置(假设你的Tomcat在C:\Java\apache-tomcat-6.0.18,工程名为test):
<Context docBase="C:\Java\apache-tomcat-6.0.18\webapps\test" path="" reloadable="true" /></Host>
其中的docBase为找到工程的路径,path就是你的工程context,这里什么也不写。如果你写成"hello",那么此时你的访问路径就是:http://localhost/hello,这里什么也没写,所以访问路径是:http://localhost