[users@httpd] detail for a rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My hosting service has my second domain name aliased to my single account.

For example, www.domain.net is aliased to www.domain.com

If a user points their browser to www.domain.com, then they are served www.domain.com/index.html

If the they point to www.domain.net, then they are served www.domain.net/o/index.html

In my .htaccess file, the following accomplishes this (but there is a glitch)

RewriteEngine on
RewriteCond %{HTTP_HOST}   ^www\.domain\.net [NC]
RewriteRule ^$   http://www.domain.net/o/index.html   [R]

If the user points to http://www.domain.net/o/ (with a trailing slash), then everything is fine.

But if they omit the trailing slash, then the url becomes (note the .com) http://www.domain.com/o/

I'd like for the url to remain .net. 

In fact, i'd like to devise a general solution, such that whenever any document in the the /o tree is requested, then the url will be rewritten to the .net.  For example if the user pointed http://www.domain.com/o/file.html, then it would be rewritten to http://www.domain.net/o/file.html

I've tried a number rewrite conditions and rules, and have consulted http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Any help would be greatly appreciated.

Thanks in advance,
Mike


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux