Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为“prj”的测试项目文件夹。在那,我有一个名为 test.php 的文件。我想要类似的东西
http://localhost/prj/test.php?t=123
应该像这样重写
http://localhost/prj/test.php
任何帮助将不胜感激
创建一个 .htaccess 文件:
RewriteEngine on RewriteRule ^prj\/test.php$ prj/test.php?t=123 [NC]
编辑
如果您的 htaccess 文件位于 prj 文件夹中:
RewriteEngine on RewriteRule ^test.php$ test.php?t=123 [NC]
在我的jsp中,如果我打电话<form action="/sampleServlet" method="get" name="form1">,我会得到以下异常:
<form action="/sampleServlet" method="get" name="form1">
http 404 错误--未找到 sampleServlet。我在 web.xml 文件中设置