Score:0

Wildcard subdomain redirection to external domain without changing the URL

cn flag

I am redirecting wildcard subdomain to a external domain using .htaccess

following is the .htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(.+?)\.example\.com$ [NC]
RewriteRule ^ https://newexample.com/%1%{REQUEST_URI} [P]

I believe I have to enable mod_proxy but not able to find the correct way to do it.

in my 000-default.conf

I need to add

ProxyPass / newexample.com/

right? I tried this but getting 500 error so I think its not the correct way to add it. would appreciate any help.

thanks

in flag
Read the error logs of your server. If you can't figure it out with the actual error message from the log, post everything relevant from your config files.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.