change RewriteBase depending on domain

2019-09-08 06:28发布

I have to set RewriteBase depending on the domain, right now RewriteBase is set to ~/myusername/folder/site.com, if someone opens http://mydomain.com it redirects to (shared HTTPS) https://something.hostingproveder/~myusername/folder/site.com , now I want to use my real domain without https and if I'm using it I need to change RewriteBase to / or to completely delete it...

Is there something in .htacces that can check which domain is used and set RewriteBase depending on domain.

1条回答
可以哭但决不认输i
2楼-- · 2019-09-08 06:36

There is no way to dynamically set RewriteBase in .htaccess.

However, if you have access to your httpd.conf here is one way to do it using AccessFileName

Even if you do not have access to your httpd.conf, the same post above has a clever way to use Environment variables (answer by mozillalives) to achieve a similar result.

查看更多
登录 后发表回答