This is a discussion on Use non-www version for url on one of my domains within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, I have problems finding information on this, so I'm asking here. With my old host, it was just ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I have problems finding information on this, so I'm asking here. With my old host, it was just a matter of clicking a button to change this. Now I run a server on my own with debian and apache2, but don't know where to make changes in the configuration. I want all the urls of one of my domains to use the version without www in front. When a visitor goes to www.mydomain.com/subdir/somepage.html, he should be redirected to mydomain.com/subdir/somepage.html. Any help? |
|
|||
|
"shittshit" <shit@invalid.inv> wrote in message news:ekspdc$l0$1@aioe.org... > Hi, > > I have problems finding information on this, so I'm asking here. > > With my old host, it was just a matter of clicking a button to change > this. > Now I run a server on my own with debian and apache2, but don't know where > to make changes in the configuration. > > I want all the urls of one of my domains to use the version without www in > front. > When a visitor goes to www.mydomain.com/subdir/somepage.html, he should be > redirected to mydomain.com/subdir/somepage.html. > > Any help? There's two parts to this. DNS and your Apache configuration for this host. Have you verified that DNS is resolving properly for this? Scott |
|
|||
|
Now you need to strip off the www using rewrites, this is explained in a great tutorial by Randall: http://www.searstower.org/rkrause/virtualhosts.html if you wanted them to both use the same set of files for now, you can just do this: ServerName www.mydomain.com and add ServerAlias mydomain.com so that both servers use the same doc root. However this will only work if you are not using mass virtual hosting, and rewrites that might interfere, and make sure any cookie logic will still work. |
|
|||
|
shimmyshack wrote:
> > if you wanted them to both use the same set of files for now, you can > just do this: > > ServerName www.mydomain.com > and add > ServerAlias mydomain.com My apache configuration is already set up exactly like you said: ServerName www.mydomain.com ServerAlias mydomain.com > Now you need to strip off the www using rewrites, this is explained in > a great tutorial > by Randall: > > http://www.searstower.org/rkrause/virtualhosts.html I'm not to good at using rewrites. I don't even know which part of that page you gave me is relevant to my problem... |
|
|||
|
shittshit wrote:
: > I want all the urls of one of my domains to use the version without www > in front. > When a visitor goes to www.mydomain.com/subdir/somepage.html, he should > be redirected to mydomain.com/subdir/somepage.html. Where is the zone file for your domain hosted? If it's on a registrar such as GoDaddy or eNom, it should be easy to change the 'www' subdomain from an A Record to a simple redirect URL (and still retain the full path and query-string). It's a lot easier that way. --Randall |