URL rewrite with ?lang= parameter
my developer is saying that it is not possible to rewrite url form example.com/name/name/?lang=english to example.com/en/name/name/
is it possible to do or not? if yes, how sho开发者_运维问答uld it be done? if not, what could be the reasons?
we have windows based hosting from maddogdomains (godaddy)
You can't "rewrite" the URL in a sense that the user will still see the ?lang parameter. However, you can redirect to a page that doesn't have that parameter.
He can check the querystring, strip the querystring, and redirect to the page without any querystring parameters. That should be very easy to do.
However, keep in mind that the user is being "redirected" to the same page, so the page will be slower to load, since it sorta loads twice.
This feature has been in .NET since version 2.0. Have your programmer look at URL Rewriting in ASP.NET by Microsoft. It can also be done by IIS (URL Rewrite), but your hoster may not support this.
Your programmer may also want to look at Routing (ASP.NET MVC Routing Overview (C#)). Routing is used by MVC, but is not limited to MVC. It can be used by ASP.NET applications as well.
If mod_rewrite is enabled at your hoster you can use it of course. Here is a tutorial: http://articles.sitepoint.com/article/guide-url-rewriting
Your developer may be wrong. There are URL rewriting modules for Microsoft IIS that can do exactly what you requested. A quick look at your host's packages fails to reveal whether such a module is enabled. Perhaps you should email their support department and ask. If it's not available, changing to a different web host is fairly easy; there are lots of good hosting companies.
Another option is to handle URL redirecting from within your application. Exactly how to accomplish that depends on the language and possibly framework it's written in and how those tools map URLs to code.
You should usually be skeptical when a developer tells you something is not possible. There's almost always a way. That's not to say it's always practical though; a good developer can offer an explanation of the tradeoffs in speed, development time and maintainability and let you make the call.
精彩评论