想要更改网址格式 [英] Want to change URL pattern

查看:41
本文介绍了想要更改网址格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我看到了这样的 URL 模式:

These days, I've seen a URL pattern like this:

http://stackoverflow.com/questions/How-to-do

不像这样的普通和旧的:

Not a usual and old one like this:

http://stackoverflow.com/questions.php?id=123

http://stackoverflow.com/questions.php?q=How-to-do

如您所知,区别在于前者使用/目录模式,后者使用?key=value&key=value....

As you know, the difference is that the former is using / directory pattern, and the latter is using ?key=value&key=value....

我想这与服务器配置有关.我的语言是JAVA和PHP,Web容器是TOMCAT6.请教我如何更改 URL 模式.因为它看起来更有条理和全新.

I guess it's something to do with server config. My language is JAVA and PHP, and Web container is TOMCAT6. Please teach me how to change URL patter. Because it looks more organized and brand new.

谢谢.

推荐答案

可以使用 Apache 上的 PHP 使用 Apache mod_rewrite 插件和放置在 .htaccess 文件中的规则定义来实现 URL 重写.这是指南.

URL Rewriting can be achieved with PHP on Apache using the Apache mod_rewrite plugin and a rule definitions placed in a .htaccess file. Here's a guide.

在 Tomcat 6 上有一个流行的 URL 重写实用程序,称为 UrlRewrite.

On Tomcat 6 there is a popular URL rewriting utility called UrlRewrite.

这篇关于想要更改网址格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆