tanmalik786 Posted September 13, 2020 Share Posted September 13, 2020 Hi friends, I am a starter with Prestashop but have reasonable good knowledge of WordPress. I have been tasked to migrate a Prestashop Shop from one server to another server and onto a new domain as well [into a sub-folder]. I have achieved the initial part of migrating this to the new domain and can successfully access it from the subfolder as well e.g., https://nikpaul.com/nikshop/. Now I want to get rid of 'nikshop' the name of the folder from the Shop URL [back end I don't mind] but haven't been able to resolve it even after struggling for hours. I have even tried to tweak with this setting - I am sure it's possible may be there's some tweak in .htaccess will do the trick here BUT I am lost. as well but it breaks the entire site, when I try to change this 'Base URI' to say '/', and I have to get into the database and restore it from there. I will really appreciate if someone from the community can come to my rescue. TIA, Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 13, 2020 Author Share Posted September 13, 2020 I will appreciate if someone can suggest a tool to achieve the same? better if it could work with v1.6.1.23 and latest build of v1.7/? as well Link to comment Share on other sites More sharing options...
Fabry Posted September 13, 2020 Share Posted September 13, 2020 Hi Tanver, from what i read i think you want to reach your shop at https://nikpaul.com...correct? Well here the problem is that Presta produce an .htaccess file ( when we have Apache server ) that is regenerated in Advanced parameters>Performance--Apache Optimization button.....so everytime you move a shop you should delete .htacess from root and you should regenerate by that button.....friendly url is another matter:-) Well but the problem is that -htaccess is generated to work inside the directory where PS is installed so..if you have a subfolder the url will have a sudfolder url to work....But if i'm not wrong you can install PS in a subfolder but leaving the url without sub-follder simply modifing the .htaccess file like this..... <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www.nikipaul.com$ RewriteRule ^(/)?$nikshop [L] </IfModule> I think it can work...try it:-) I hope you fix it Bye Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 14, 2020 Author Share Posted September 14, 2020 Hi @Pablus, I already have it like you have suggested but it has not produced the desired results. @Fabry I am sure this .htaccess is the way to go BUT unfortunately has not worked either, let me restate the thing again here. What I am trying to achieve is to get an end URL https://nikpaul.com/ for the visitors, where my PS remains installed in the Subfolder [nikshop], with an absolute path like https://nikpaul.com/nikshop/. Note: I have enabled the 'Apache Optimization' switch as suggested, but couldn't understand [so everytime you move a shop you should delete .htacess from root ..] I didn't find any generated .htaccess file in the 'public_html' folder, I do find one in the 'nikshop' folder though - do you want me to move this file in the domain root folder [public_html]? Thanks for the response for both of you, hope the community will get me through this. Thanks! Link to comment Share on other sites More sharing options...
JBW Posted September 14, 2020 Share Posted September 14, 2020 You have to link your domain to your subfolder, thats a setting in your webhosting. Adjusting the URL and .htaccess ad described befor might have to be re-done afterwards. Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 14, 2020 Author Share Posted September 14, 2020 @JBW you mean I will have to point my [main] domain to this sub-folder, correct? strange Link to comment Share on other sites More sharing options...
JBW Posted September 14, 2020 Share Posted September 14, 2020 Yes, not so strange in my opinion Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 14, 2020 Author Share Posted September 14, 2020 @JBW There should have been a simpler solution like in WordPress. Anyway in this case what will be the fate of any 'files' placed directly under 'public_html' folder? Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 14, 2020 Author Share Posted September 14, 2020 (edited) I was just wondering that in cases when our main domain account points to a sub-folder [directly under public_html] then in those cases can we still access the files [one level above] the sub-folder. @Pablus I think the way you are suggesting [redirection] the sub-folder in my case 'nikshop' will be visible to the visitors, and I don't want that. I think the solution is to point my main domain to this sub-folder, in this can the domain [https://nikpaul.com] will directly point to the files under subfolder [nikshop], without displaying 'nikshop' in the URL. Thanks Edited September 14, 2020 by Tanver (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted September 15, 2020 Share Posted September 15, 2020 I am puzzled what you want to do. The server directory where your shop url points to is a job of the local DNS. You can set that in Cpanel or whatever similar software you use. I guess it will be possible to modify .htaccess in such a way that it standard inserts a subdirectory in the url that you give it. But that wouldn't be a wise solution. And it isn't implemented in Prestashop. Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 17, 2020 Author Share Posted September 17, 2020 @musicmaster I am sorry if it's caused some confustion to you, let me try to explain it again here. I have a domain [main] which points to the 'public_html' folde, thatr is the standard practice and normal domain's default URL is https://nikpaul.com/ I have installed my PS shop in a sub-folder called 'nikshop' which is directly below this domain's root folder I mean 'public_html', which can be accessed as https://nikpaul.com/nikshop Now all I want to achieve is to find out a way to access this domain by using the root url [https://nikpaul.com/] while leaving my source files in the sub-folder 'nikshop', which I know is possible using some .htaccess and have tried to figure it out by placing an .htaccess the 'public_html' folder. Hope now it's at least understood correctly, as to what I am trying to achieve, and someone from the community can advise me even if it's possibe in PS [know it can be done in WordPress, and other PHP frameworks]. Thanks for reading! Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 17, 2020 Author Share Posted September 17, 2020 I just got the opportunity to revisit the entire episode and figured it out that I have missed on resetting the 'Base URI' back to '/' from '/nikshop' - which I set earlier while migrating the domain from another host and URL. All I have to do was to set it to '/' and put the following in my htaccess at 'public_html' folder. Now I have this in my .htaccess file .. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L] RewriteCond %{HTTP_HOST} ^(www\.)?nikpaul\.com$ RewriteRule !^nikshop/ /nikshop%{REQUEST_URI} [L] </IfModule> Sorry for creating confusion and thanks again for the help extended to me .. Glad it worked! 1 Link to comment Share on other sites More sharing options...
tanmalik786 Posted September 17, 2020 Author Share Posted September 17, 2020 @Pablus yes this 'Hi, if you point your domain to a sub-folder..' this should have worked BUT wouldn't have been a good practice. What if the client wanted to host another domain [bear in mind the webroot for this domain would have been shifted to 'public_html/nikshop']? - the folder or installations files for this new domain will have to reside under this sub-folder [which is the domain root]. 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