Here is an example how to force no-www domain on Servepilot Digitalocean VPS servers with Nginx. Create /etc/nginx-sp/vhosts.d/techcat.d/0www_redirect.conf with code that will force all www pages 301 redirect to a naked no-www domain. Code: if ($host ~* www.techcat.ca$) { return 301 http://techcat.ca$request_uri; } restart nginx with the command Code: sudo service nginx-sp restart If you would like to force all no-www pages to www. Code: if ($host ~* techcat.ca$) { return 301 http://www.techcat.ca$request_uri; } More info on Nginx redirects https://serverpilot.io/community/articles/how-to-redirect-based-on-the-requested-domain-name.html
Thank you that worked out very nicely Do you also know how to force https to all of that? Right now I'm using these rules in my htaccess Code: RewriteCond %{ENV:HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L] It works but it's not an elegant solution. Do you know how to achieve this via conf-file? I tried for hours and didn't get anywhere.
M/s CLEARPATH NETWORK INFOTECH (CNI). we have a tendency to are a proactive firm primarily based in New Delhi, India, specializing in custom-built computer code Development Company, internet development style with interactive flash animation & networking solutions, it's established on 14 March 2014 by the cluster of Technical ability person. https://www.cnisolution.net/ https://www.cnisolution.net/web-development.php https://www.cnisolution.net/bulk-sms.php https://www.cnisolution.net/web-maintenance.php https://www.cnisolution.net/web-application-development.php https://www.cnisolution.net/window-application-development.php https://www.cnisolution.net/online-examination.php https://www.cnisolution.net/erp-app-development.php https://www.cnisolution.net/ecommerce-website-development.php https://www.cnisolution.net/search-engine-optimization.php