[英]subdomain to subfolder on Heroku PHP site?
How can I get this domain.. 我如何获得此域名。
api.somewebsite.com
to point to this actual location.. 指向这个实际位置。
somewebsite.com/api
I'm using a simple PHP page on Heroku, with .htaccess file. 我在Heroku上使用一个简单的PHP页面,带有.htaccess文件。
I already setup the subdomain with my dns hosting and add a subdomain via heroku cli. 我已经使用DNS托管设置了子域,并通过heroku cli添加了子域。
this is what ive tried so far.... 到目前为止,我已经尝试过了...。
RewriteEngine on
RewriteCond %{HTTP_HOST} ^api\.somewebsite\.com$
RewriteRule ^ /api [L]
and 和
RewriteEngine on
RewriteCond %{HTTP_HOST} ^api\.somewebsite\.com$
RewriteRule .* /api [L]
to no avail... the browser is making 无济于事...浏览器正在
api.somewebsomesite.com go to api.somewebsite.com/api
I want to take out the subdomain in the ^ 我想取出^中的子域
how to accomplish this using .htaccess? 如何使用.htaccess完成此操作?
This should do the trick 这应该可以解决问题
RewriteEngine on
RewriteCond %{HTTP_HOST} ^api\.example\.com$
RewriteRule ^ http://example.com/api%{REQUEST_URI} [L,R=301]
Try this rule: 尝试以下规则:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^api\.somewebsite\.com$
RewriteRule ^ http://somewebsite.com/api [L,R]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.