[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

help modrewrite

I have www.mydomain.com

I want it to redirect to www.mydomain2.com/werwaer/php?=  you get the point

the goal here is that when the person goes to mydomain.com it goes to the mydomain2.com url but doesn't show the user they are there

on a web host running apache

how can i accomplish
  • 2
1 Solution
Are both domains pointing to th same location or are this different accounts?
shankshankAuthor Commented:
what do you mean by same location?

basically www.mydomain1.com i want it toforward to www.mydomain2.com/2342qre/2342q

I can park or add the second domain as an addon domain in my cpanel
Many people set up multiple domains which are pointing to the same location, i.e. /var/www/html/ instead if /var/www/dom1/ for domain1 and /var/www/dom2/ for domain2.

You can use an internal rewrite if both domains point to the same location. If not, you'll need a reverse proxy setup and the proxy modules to fetch content from domain2 into the scope of domain1 so that the URL in the location bar of the browser doesn't change to domain2.

The reverse proxy can be set-up with mod_rewrite (p flag - ProxyPass) in a .htaccess file but for full reverse proxying including adjusting location headers, cookie domains and cookie paths, access to the httpd.conf is needed.
RewriteEngine on
# matches the root request only, no further resources
RewriteRule ^$ http://www.mydomain2.com/2342qre/2342q [P]

Open in new window


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now