Quick htaccess question

I'm altering the domain connected having a site and wish to determine if I'm able to setup the htaccess to create the next kinds of redirects:

Redirect http://world wide web.oldomain.com/contact-us

to http://world wide web.newdomain.com/contact-us

Essentially a worldwide redirect that redirects towards the new domain but keeps the relaxation from the URL the user typed.

UPDATE: I wound up while using following code and delay pills work perfectly

Options +FollowSymLinks

RewriteEngine On

RewriteCond % ^olddomain.com$ [OR]

RewriteCond % ^world wide web.olddomain.com$

RewriteRule (.*)$ http://world wide web.newdomain.com/$1 [R=301,L]

Sure, this can be done easily without needing to wreck havoc on cryptic RewriteEngine instructions. (RewriteEngine has its own place, but it is definitely not required for simple things like this.)

Redirect permanent / http://newdomain.com/

The Redirect directive instantly preserves anything following a area of the path it has been expected to redirect. The documentation for that Redirect directive describes this by having an example:


Redirect /service http://foo2.bar.com/service

When the client demands http://myserver/service/foo.txt, it will likely be told to gain access to http://foo2.bar.com/service/foo.txt rather.

This will get it done for you personally.

RewriteEngine on

RewriteCond % ^oldname.com

RewriteCond % ^oldname.com

RewriteRule ^(.*)$ http://world wide web.newname.com/$1 [R=301,QSA,L]


Should you take control of your own httpd, possibly you should check around the configurations of NameVirtualHost directive in httpd.conf. See http://httpd.apache.org/paperwork/2./mod/core.html#namevirtualhost

Automatically, httpd isn't set up to complete title-based virtual hosting. You have to enable that through NameVirtualHost. Later on, attempt to perform the redirects as recommended by Greg Hewgill.

Tell us in the event that works.

Thanks, Ismael Casimpan