subdomain redirect to extern url path with keeping the name of subdomain

55 Views Asked by At

I want a redirect from a subdomain to an external URL to a page of this URL. I need to show the subdomain in the URL. Not the external domainname with path.

I tried it in .htaccess in the subdomain of this rootdomain. But nothing so far is working.

I have the following code:

RewriteEngine On RewriteCond %{SERVER_PORT} 80

RewriteCond %{HTTP_HOST} ^elvis.ocien.be$ [OR]

RewriteCond %{HTTP_HOST} ^www.elvis.ocien.be$

RewriteRule ^(.*)$ https://servicebox.be/quarki/software/elvis-dam/$1 [QSA,L,R=301]

I tried it with [P] instead [QSA,L,R=301] on the last rule. But that returns in a failure. Does anyone knows how to do this. Also with keeping the SSL HTTPS working?

Hope someone knows how to do this, thanks already

1

There are 1 best solutions below

0
On

thanks for the reply,

I do not know how to see if mod_proxy is available.

I own and host both sites/domainnames and have access to the DNS settings, also in WHM and cPanel. So yes there is a partnership.

When I use the flag [P] it is giving me the following:

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Hopefully my writing is better to understand now.

Thanks already, Kiona