IeM Posted March 3, 2013 Share Posted March 3, 2013 Hi, I have to integrate an affiliate program application that uses subdomain links to Prestashop 1.5. Multi-Store can not be used for a few reasons to do with other functionality. There are other reasons to use the membership subdomains as well. We need to use wildcard subdomains so this has been set up on the server and the subdomains do access the site, but the URL is rewritten to www.domain.com instead of sub.domain.com I am guessing that the htaccess file would have to be modified. Can anyone tell me how to modify Prestashop 1.5 to allow http://wildcard.domain.com to display in the URL. Thanks. Link to comment Share on other sites More sharing options...
IeM Posted November 3, 2015 Author Share Posted November 3, 2015 I was asked the same question by another member trying to solve this same issue. While I have not got a complete solution, this is what I answered him with: I needed to use wildcard subdomains for my multi-store and I could not find any answers. After spending about US$1500 for programmers that could not quite get it right I came up with my own hack that does the job with one downside, and that is the site will still always revert back to www.domain.com. However, in the mean time I grabbed the subdomain value. Basically I inserted a script at the beginning of the index page that grabbed the value of the subdomain, stored it as a session or constant, and then reset the header as www.domain.com. I can then use that value in my scripts. What prestashop does is when it gets a non www subdomain is reset the header to www.domain.com and the site reloads. I am really looking forward to the day that Prestashop enables subdomains as there is a number of uses for them. Hope this helps you and anyone with the same very frustrating issue. Link to comment Share on other sites More sharing options...
wagood Posted July 6, 2016 Share Posted July 6, 2016 I try and make working wildcard subdomains. First of all you must make changes in apache server and add server alias, something like this in my version: ServerName domain.ru ServerAlias *.domain.ru than you must modify generateHtaccess function in Tools.php to write right Rewrite Condition ^(.+\.)?'.$domain.'$ instead of the old version ^'.$domain.'$ now you can get subdomain name and make some overrides over Frontcontoller and Link and Dispatcher classes for the right recognition of controller and his actions for subdomains (changes depends on what you needed to get via subdomain). In my case I want to get the city name from subdomain and show different content for different cities. Something like paris.domain.ru or praha.domain.ru . I hope it will help to understand the right way Link to comment Share on other sites More sharing options...
groovybryce Posted August 23, 2016 Share Posted August 23, 2016 Hi wagood I have exactly the same need as you! i tried to apply your code in Tools php but my site always redirect to the main domain. The wildcard is well configured. I made a test on the same server with a simple php file outside my prestashop site and it works. Do you have any idea? Thanks in advance ! Link to comment Share on other sites More sharing options...
wagood Posted August 23, 2016 Share Posted August 23, 2016 Hi wagood I have exactly the same need as you! i tried to apply your code in Tools php but my site always redirect to the main domain. The wildcard is well configured. I made a test on the same server with a simple php file outside my prestashop site and it works. Do you have any idea? Thanks in advance ! I was just first step. Now you have the subdomain as a variable in script and can handle it for future use. You must make some overrides over Frontcontoller, Link, Dispatcher classes. The changes depends on what you want to get via subdomain. I don't have universal solution. Link to comment Share on other sites More sharing options...
El Patron Posted August 23, 2016 Share Posted August 23, 2016 You all may find this module useful, add as many subdomains as you like, but you have to define them. https://www.prestaheroes.com/en-us/prestashop-seo-solutions/73-international-seo-multishop-pro.html Link to comment Share on other sites More sharing options...
groovybryce Posted August 23, 2016 Share Posted August 23, 2016 Thank you Wagood for your assistance i am a bit confused about this condition if (Shop::isFeatureActive()) { in the rewrite condition. It doesnt change anything if i modify the function or put anything, there is no impact on front-office. Here is my code. if (Shop::isFeatureActive()) { fwrite($write_fd, 'RewriteCond %{HTTP_HOST} ^(.+\.)?'.$domain.'$'."\n"); } My need is just to accept wildcard subdomain in prestashop. Many thanks for your support Link to comment Share on other sites More sharing options...
wagood Posted August 23, 2016 Share Posted August 23, 2016 (edited) Where you find this code? I have 1.6.0.9 version and don't see this code. Shop::isFeatureActive() check if multishop feature is active. Edited August 24, 2016 by wagood (see edit history) Link to comment Share on other sites More sharing options...
Marius05 Posted May 13, 2018 Share Posted May 13, 2018 What classes i have to modify on 1.7 to have vor products, product name as subdomain? Example: http://www.domain.com/producturl -> http://producturl.domain.com. Thank you in advance! Link to comment Share on other sites More sharing options...
Marius05 Posted May 14, 2018 Share Posted May 14, 2018 Nobody? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now