Home Should be simple domain alias ala mod_rewrite
Reply: 1

Should be simple domain alias ala mod_rewrite

Duane Lortie
1#
Duane Lortie Published in 2017-12-02 23:28:02Z

Problem.

I am using mod_rewrite on a Godaddy account, shared, cpanel linux webserver... I am trying to serve content from domain 1, when domain 2 is requested as an invisible redirect.. aka domain aliasing

domain1 is a wordpress site. I'm trying to get a wordpress /catagory/page to act as the content for domain 2. In fact domain 2 should have only that one page of content available, where we have a form 2 email page set up.

Ideally, Any other get requests should visibly redirect to the actual domain. Naturally a post request should go to the form on the aliased domain (2)...

Googling relevant search terms results in major information overload. I'm sure the answer is out there, I just can't find the solution to this exact scenario. Meanwhile I suspect Godaddy is caching .htaccess, making it even more difficult to find a working solution in a timely manner.

I've tried several variations, waiting 15 minutes between edits, flushing browser cache etc. I can't seem to find the correct syntax, and/or Godaddy caches .htaccess longer than 15 minutes.

My last attempt

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www.domainalias.com$[OR]
RewriteCond %{HTTP_HOST} ^domainalias.com$
RewriteRule .* http://www.actualdomain.com/subdir/subdir/ [R=301,L] 

That seems like it should do exactly what I want, but it doesnt. It does show the domainalias address in the browser URL bar (GOOD) BUT, it displays the home page from http://www.actualdomain.com/ (BAD)

It should display http://www.actualdomain.com/subdir/subdir/ while keeping www.domainalias.com in the adress bar.

What am I missing ?

Duane Lortie
2#
Duane Lortie Reply to 2017-12-04 19:23:36Z

I am still not entirely sure why my prior attempts did not redirect at all, neither visibly or invisibly.. But after some sleep and more reading, I've got exactly what I needed with the following syntax.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/PathToPageHere [P] 
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317985 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO