我的web应用程序url类似http://www.example.com
现在,我希望最终用户将始终看到http://www.example.com在那里
浏览器插入了类似的内容http://www.example.com/index或之后的任何东西/将不会显示给最终用户
即http://www.example.com/abc.php?id="someid">
将在用户浏览器中显示为http://www.example.com
提前谢谢你,很抱歉英语不好。。。。。
有几种方法可以做到这一点。REST web服务、URL缩短、更改别名或创建.htaces文件。
一个简单的方法是在根目录中创建一个.htaccess文件。
如果您正在运行Apache,您可以通过在站点的.htaccess文件中创建重定向来实现这一点。如果你还没有,只需在网站的根目录中创建一个名为".htaccess"的新文件。
将其保存在.htaccess文件中:
<IfModule mod_rewrite.c>
RewriteEngine On
# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
这个重写规则基本上说,"如果有一个请求没有映射到现有的文件夹或文件,请将其传递到index.php。">
来源http://buildwithcraft.com/help/remove-index.php
并检查此htaccess从url 中删除index.php