Want to change URL pattern
These days, I've seen a URL pattern like this:
http://stackoverflow.com/questions/How-to-do
Not a u开发者_Go百科sual and old one like this:
http://stackoverflow.com/questions.php?id=123
or
http://stackoverflow.com/questions.php?q=How-to-do
As you know, the difference is that the former is using /
directory pattern, and the latter is using ?key=value&key=value....
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.
Thank you.
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.
On Tomcat 6 there is a popular URL rewriting utility called UrlRewrite.
What you want is Apache's mod_rewrite
Check this out: apache.org
精彩评论