0

I have a number of clients in the field accessing a web service using a format like this: www.mydomain.com/page/

I would like to redirect that URL to subdomain.mydomain.com/, where www.mydomain.com is on one server and subdomain.mydomain.com is on another server. Both servers have comfortable and functional homes in the DNS zone records.

I have some knowledge of Apache Redirect, but I cannot get this one quite right. Suggestions and links to articles are most welcome.

2 Answers 2

1

I think you You need to see Apache Mod_Rewrite

create .htaccess file on root of www.mydomain.com/

and place something like following in .htaccess, it is a permanent redirect (301)

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com [NC]
RewriteRule ^(.*)$ http://subdomain.mydomain.com/$1 [L,R=301,NC]

Above rule should redirects

mydomain.com/page1.html

to

http://subdomain.mydomain.com/page1.html

Again Please See Apache Mod_Rewrite for details.

0
0

This is the most simple text-book mod_alias Redirect you could use on any context (server config, virtual host, directory, .htaccess).

Redirect /page1/ http://subdomain1.example.com/
Redirect /page2/ http://subdomain2.example.com/

If you also need to redirect /page1 without the / you can remove it, but remember that it'll also match anything else with the same beginning, e.g. /page14.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .