Dear all, up to now I use the dbfilter as subdomainfilter and it works grea (odoo.domain.com, odoo2.domain.com)
Now I want to use it as the main domain (domain.com, www.domain.com)
for doing this I changed the databasename from odoo to domain-com and changed the d to h in
/etc/odoo-server.conf
/odoo-server/odoo/tools/config.py
and it functions to the limit that entering domain.com goes directly to the database, but entering www.domain.com goes to the database admin.
To my limited knowledge the code in http.py should equalize the www.domain to domain, or am I wrong?
def db_filter(dbs, httprequest=None):
httprequest = httprequest or request.httprequest
h = httprequest.environ.get('HTTP_HOST', '').split(':')[0]
d, _, r = h.partition('.')
if d == "www" and r:
d = r.partition('.')[0]
r = odoo.tools.config['dbfilter'].replace('%h', h).replace('%d', d)
dbs = [i for i in dbs if re.match(r, i)]
return dbs
in the apache VH I have the following setup
<VirtualHost *:80>
ProxyPreserveHost On
ServerName domain.com
ServerAlias www.domain.com
<Directory /var/www/html> #HERE I TRIED TO INSTALL A .HTACCESS FROM WWW TO DOMAIN, BUT WITHOUT EFFECT TO ODOO
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ProxyRequests Off
ProxyPass / http://localhost:8069/
ProxyPassReverse / http://localhost:8069/
ProxyVia On
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://domain.com:8069/
ProxyPassReverse / http://domain.com:8069/
SSLEngine on
SSLProxyEngine on
SSLCertificateFile **/fullchain.pem
SSLCertificateKeyFile **/privkey.pem
Include **/options-ssl-apache.conf
</VirtualHost>
Like I wrote I have tried to include a htaccess rewrite but it has no effect.
Any ideias what I have missed?
Thank you!
just to add this, as I cant edit my post. I tried it with 2 virtual hosts, one domain one www.domain and both with permant redirect to domain:
Redirect permanent / https://domain.com/
but does not work out
Thanks Ermin, the answer was so easy. Just change the name of the database to domain, not domain-com and leave everthing to d, and it works.
As I said :-)