Match domain with or without www
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 16
- Joined: 06 Jun 2024, 04:34
Match domain with or without www
Aimeos 2024.07
Laravel 11
PHP 8.2
Hello, is there a setting or a way to map a domain to be the same with or without www? right now aimeos treats www.domain.com and domain.com as being two different domains and I would like to treat it as the same domain. I'm not sure where to look into changing that as in if there's a config setting I might have missed or do I need to look into a specific file?
Laravel 11
PHP 8.2
Hello, is there a setting or a way to map a domain to be the same with or without www? right now aimeos treats www.domain.com and domain.com as being two different domains and I would like to treat it as the same domain. I'm not sure where to look into changing that as in if there's a config setting I might have missed or do I need to look into a specific file?
Re: Match domain with or without www
No, there's no such setting. The solution is to add a redirect in your web server from www.domain.com to domain.com
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 16
- Joined: 06 Jun 2024, 04:34
Re: Match domain with or without www
In case anyone else needs this, here's the .htaccess for this:
Code: Select all
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>