Link to home
Start Free TrialLog in
Avatar of RCairns54
RCairns54

asked on

dynamically add www before my domain name url

When some one types in mydomain.com/about.aspx I need to dynamically place www. before the domain name if it is not present: www.mydomain.com/about.aspx. Can some one tell me the best way to accomplish this?

Thanks.
Avatar of ICaldwell
ICaldwell
Flag of United States of America image

This is usually something controlled at the web server.... one web server is just setup to take every request, add the www. onto it and then post back, this can be done in a request string....

Question is do you want to take this much time to do it or just setup your main website with your IP of your server and set an alias for www to your main server, that way both ways will work.

Personally I would not redirect users but let them have the option of having it or not, both will work...
Avatar of RCairns54
RCairns54

ASKER

Thanks for your quick reply.

I have iis set up to handle both the domain and the www subdomain requests, but for seo reasons I need to have the www in the url every time. I have used 301 redirects but this is pretty static and takes you to one base url. I thought about handling the request at the app level, caching the url and adding www to the string and redirect but I was hoping to find a way to do this outside of the web app.

Here is an example of what I'm looking for:
If you go to www.bing.com and preform a search and then delete the www. off the url and hit enter it adds it back. This is basically the effect Im looking for.
ASKER CERTIFIED SOLUTION
Avatar of ICaldwell
ICaldwell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sweet. Thanks for pointing me in the right direction.