NULL
NULL

Reputation: 1589

Redirect URL but keep existing URL

I have a client who has a registered domain: www.newsite.com. I have a product that sits on mysite.com/product. The client is currently pointing its site to my product, however, the URL changes to mysite.com/product. The client doesn't like that, and wants his website to stay: www.newsite.com so there is this .htaccess on my site. So I went ahead and started modifying, however, when I added the last bottom two lines to the file, it sort of broke the .htaccess and started redirecting everything to mysite.com/product. Maybe I don't understand the .htaccess. Below is the original, which goes to www.sitebat.com:

IndexIgnore *

RewriteBase /
RewriteEngine on

#RewriteCond %{HTTP_HOST} !^sitebat\.com
#RewriteRule (.*) http://sitebat.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]

RewriteCond %{HTTP_HOST} ^sitecat\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.sitecat\.com$
RewriteRule ^/?$ "http\:\/\/mysite\.com" [R=301,L]

Then I added this:

RewriteCond %{HTTP_HOST} !^newsite\.com
RewriteRule (.*) http://newsite.com/$1 [R=301,L]

Now everything in this .htaccess points to mysite.com/product, which is wrong.

I also created add-on domains and sub domains in my cpanel for the client's registered domain.

Thanks for your help.

Upvotes: 0

Views: 1576

Answers (1)

Jeffrey
Jeffrey

Reputation: 1804

No matter what you do with htaccess, you cannot redirect the user to another site, without the user knowing it. It would be wrong if you go to your bank's website, while actually you are on a hacked server.

You have a few options, one is to setup a proxy on your clients webserver, that proxies the client to your website.

Another option is to use an Iframe on your client's site

and last but not least, to provide an API, so that the content can be shown on the client's site, while the database is located on yours.

Upvotes: 2

Related Questions