views:

285

answers:

4

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 should it be done? if not, what could be the reasons?

we have windows based hosting from maddogdomains (godaddy)

+1  A: 

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.

SkippyFire
A: 

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

neo
+1  A: 

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.

JonnyBoats
A: 

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.

Zak
Thank you for the answer.Ok, the hosting condition have changed. Now we have windows based server with IIS7 with url rewrite plugin and PHP framework.what whould be the rule for this rewrite?
agorom7
@agorom7 - hosting on Windows/IIS when your application is written in PHP is an unusual choice, and may make life more difficult for you. Apache is a more common choice for hosting PHP, and almost always has URL rewriting enabled. That said, links to tutorials and documentation for the plugin can be found here: http://learn.iis.net/page.aspx/664/using-url-rewrite-module-20/
Zak