I am new to Magento. Successfully installed/implemented Magento 2.2.5. However, I installed Magento as subfolder in root. And my cart shows as mydomainname.com/Magento. I want to change it so public does not see 'Magento' in my URL. One user sent me this post. Installing Magento2 subfolder url. Based on this post, it appears that I only have to edit the .htaccess file. My .htaccess file has this code in the beginning:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ mydomainname.com/Magento/$1 [R=301,L] 

And the automatic Redirect code at the end:

RewriteCond %{HTTP_HOST} ^mydomainname\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomainname\.com$
RewriteRule ^/?$ "https\:\/\/www\.mydomainname\.com\/Magento\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^mydomainname\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomainname\.com$
RewriteRule ^cgi\-bin\/commerce\.cgi$ "https\:\/\/www\.mydomainname\.com\/Magento\/" [R=301,L]

Should I change the code at the bottom too? Or simply change redirects, by removing word 'Magento' on Cpanel to auto generate it?

Do I have to copy index.php file too to root or leave it where it is?

How will Admin panel be accessed, after making above changes?

Additionally, I know I have to change the Web server configuration in Admin panel. Last time I did those changes, I lost my Admin Panel access, and my website lost its images and formatting. I recall checking 'Use system Value' after making the changes in URL for both secure and unsecure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.