A few weeks ago I’ve challenged to make some routing with Apache’s mod_rewrite
.
The task was to show http://someapp.heroku.com
when user visit http://site.com/heroku
.
Ok, it seems to be not a problem to extend .htaccess
file one RewriteRule
string:
1
|
|
But our http://site.com
running Wordpress, so the new rule must be separated with conditions:
1 2 |
|
Looks nice, and it works, but Heroku returns Bad Request
error when I’ve tried to visit “rewrited” page. After some derping over internet, I found, that Heroku needs
request header host
to be set with an app domain, someapp.heroku.com
in my case. But looking forward, I’ve noted that
Wordpress using request header host
for it’s own purposes (e.g. link generation in admin), so I need to make another
condition for request header. And here it comes - the final result:
1 2 3 4 |
|
And after that manipulations - it works like charm now!