Reputation: 2311
Using .htaccess, I'm trying to redirect a single page under a domain that I own to heroku.
I don't want users to see the heroku app url in the browser, so I'm trying this in my .htaccess file:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^mydomain.com/mypage
RewriteRule ^(.*) http://app-heroku.com [P]
This is based on what I've found here, the [P] being for proxy. Unfortunately this isn't working though. My knowledge about the Apache rewrite engine is quite limited. Any ideas?
Upvotes: 1
Views: 439
Reputation: 41219
domain name is not part of match in %{THE_REQUEST}
You need to use an additional RewriteCond to match the domain name
RewriteEngine on
#if host ==domain.com
RewriteCond %{HTTP_HOST} ^domain\.com$
#and uri==/mypage
RewriteCond %{THE_REQUEST} /mypage
#redirect the request to http://app-heroku.com
RewriteRule ^(.*) http://app-heroku.com [P]
Upvotes: 1