Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

htaccess for magento in subdirectory
 
Revolve82
Jr. Member
 
Total Posts:  23
Joined:  2009-05-19
 

Will this approach affect SEO?

Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
Revolve82
Jr. Member
 
Total Posts:  23
Joined:  2009-05-19
 
michael_in_pp - 15 October 2009 01:26 AM

scorxn - 04 December 2008 11:00 AM
Lots of overcomplication going on in this thread. Here’s what worked for me with 1.1.8:

Givens (Substitute as necessary)
a. /public_html/ is your root web directory
b. /public_html/magento/ is where you want to store Magento
c. domain.com is your domain name

Steps
1. Install Magento to /public_html/magento/ normally. Do not change Base URL during installation.
2. Copy /public_html/magento/.htaccess to /public_html/.htaccess
3. Copy /public_html/magento/index.php to /public_html/index.php
4. Edit /public_html/index.php line 32 to read:
$mageFilename 'magento/app/Mage.php';
5. Log into Magento Admin. Go to System > Configuration > Web
6. Under Unsecure change Base Link URL to http://domain.com/
7. Under Secure change Base Link URL to https://domain.com/

This with additional steps from bbodine1 works fine in version 1.3.0 too.

Hi, most URL works fine, however i am unable to load system->magento connect->magento connect manager, any solution?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gray_um16
Jr. Member
 
Total Posts:  5
Joined:  2009-02-27
 

Hello, Revolve82

You would just need to add your ‘subfolder’ after ‘YourDomain.com’ in the address bar, after you select Magento Connect Manager from the dashboard.

Steps to take:

1) System > Magento Connect > Magento Connect Manager (this will display the “Woops, our bad” page)

The url will look something like this:
http://www.YOURDOMAIN.COM/downloader/?return=httpBLA BLA BLA…

2) Add your ‘subfolder’ to the url to look something like this:

http://www.YOURDOMAIN.COM/SUBFOLDER/downloader/?return=http BLA BLA BLA…

The Magento Connect Manager login page will be displayed.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jlytle
Jr. Member
 
Total Posts:  8
Joined:  2010-06-04
 

I added a symlink to the downloader folder in my root folder before magento that allows domain.com/downloader/ to work easily.

 
Magento Community Magento Community
Magento Community
Magento Community
 
javaman
Jr. Member
 
Total Posts:  9
Joined:  2008-06-11
 

Hi all.
Do these steps work for Magento v1.4.+ or have there been changes to simplify this process?
Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
ontic
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2009-09-09
 

Here’s what I typically do when installing Magento inside a subdirectory.

Givens (Substitute as necessary)

a. /public_html/ is your root web directory
b. /public_html/magento/ is the directory where Magento will be installed
c. http://www.domain.com is the domain name which points to your root directory

Steps

1. Extract the Magento files to your /public_html/magento/ directory
2. Navigate to http://www.domain.com/magento and install Magento as normal (Don’t change the Base URL during installation)
3. After installing Magento, log into the backend and disable all cache (Don’t log out, you will need to change some settings later)
4. Copy /public_html/magento/.htaccess to /public_html/.htaccess
5. Copy /public_html/magento/index.php to /public_html/index.php
6. Edit /public_html/index.php and make the changes listed below.

Line 40$compilerConfig 'magento/includes/config.php';
Line 45$mageFilename 'magento/app/Mage.php';
Line 46$maintenanceFile 'magento/maintenance.flag';
Line 49: if (is_dir('magento/downloader'))
Line 50header("Location: magento/downloader");
Line 58: include_once dirname(__FILE__) . '/magento/errors/503.php';

7. Navigate to System->Configuration->Web and change your Unsecure and Secure settings to what’s shown below

Base URLhttp://www.domain.com/
Base Link URL{{unsecure_base_url}}
Base Skin URL
{{unsecure_base_url}}magento/skin/
Base Media URL{{unsecure_base_url}}magento/media/
Base JavaScript URL{{unsecure_base_url}}magento/js/

Base URLhttp://www.domain.com/
Base Link URL{{secure_base_url}}
Base Skin URL
{{secure_base_url}}magento/skin/
Base Media URL{{secure_base_url}}magento/media/
Base JavaScript URL{{secure_base_url}}magento/js/

8. As a work around for not being able to access the Magento Connect Manager. Add the line below to your /public_html/.htaccess file.

#RewriteBase /magento/
RedirectMatch ^/downloader/(.*) /magento/downloader/$1

9. Save the changes and your done.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cupandacu
Jr. Member
 
Total Posts:  30
Joined:  2010-12-23
 

Hi,

Thanks all....
For those that stumble across this post, just use Ontics instructions and it works a treat..

I too am curious whether this approach would effect SEO though?

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
ontic
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2009-09-09
 

@cupandacu I can’t see how having Magento installed in a sub directory would have a negative impact on search engines. The approach I mentioned above will produce links without the sub directory ("magento") being seen in URL’s. To get a better understanding take a look at the Mage:getBaseUrl() method and the different types of URL’s which can be generated.

Mage_Core_Model_Store::URL_TYPE_LINK http://www.domain.com/
Mage_Core_Model_Store::URL_TYPE_SKIN  http://www.domain.com/magento/skin
Mage_Core_Model_Store::URL_TYPE_MEDIA http://www.domain.com/magento/media
Mage_Core_Model_Store::URL_TYPE_JS http://www.domain.com/magento/js

For those using this setup, be aware that there is a bug where the “Browse.” & “Upload” media buttons are not displayed when creating or editing product images. Although, I can confirm that it has been fixed in Magento CE 1.5.0.0-beta2. You can read more about this issue here http://www.magentocommerce.com/bug-tracking/issue?issue=10568 with a quick fix.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cupandacu
Jr. Member
 
Total Posts:  30
Joined:  2010-12-23
 

Hey Ontic,

Thanks for the comments...What you are saying makes sense…

Cheers…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sistemi Informativi
Jr. Member
 
Total Posts:  17
Joined:  2009-11-19
Italy
 

after
“Here’s what I typically do when installing Magento inside a subdirectory. “
i find this error
Fatal Error Mage.php Line 50
AND FEW WARNING IN LINE 49

Solution :
set absolute path in the file /app/Mage.Php
Line 49 and 50

Line 48 set_include_path($appPath . PS . Mage::registry(’original_include_path’));
49 include_once “/YOURFOLDER/lib/Varien/Core/functions.php”;
50 include_once “/YOURFOLDER/lib/Varien/Autoload.php”;

 
Magento Community Magento Community
Magento Community
Magento Community
 
albertramsbottom
Sr. Member
 
Total Posts:  78
Joined:  2010-12-20
 
ontic - 22 December 2010 12:55 PM

Here’s what I typically do when installing Magento inside a subdirectory.

Givens (Substitute as necessary)

a. /public_html/ is your root web directory
b. /public_html/magento/ is the directory where Magento will be installed
c. http://www.domain.com is the domain name which points to your root directory

Steps

1. Extract the Magento files to your /public_html/magento/ directory
2. Navigate to http://www.domain.com/magento and install Magento as normal (Don’t change the Base URL during installation)
3. After installing Magento, log into the backend and disable all cache (Don’t log out, you will need to change some settings later)
4. Copy /public_html/magento/.htaccess to /public_html/.htaccess
5. Copy /public_html/magento/index.php to /public_html/index.php
6. Edit /public_html/index.php and make the changes listed below.

Line 40$compilerConfig 'magento/includes/config.php';
Line 45$mageFilename 'magento/app/Mage.php';
Line 46$maintenanceFile 'magento/maintenance.flag';
Line 49: if (is_dir('magento/downloader'))
Line 58: include_once dirname(__FILE__) . '/magento/errors/503.php';

7. Navigate to System->Configuration->Web and change your Unsecure and Secure settings to what’s shown below

Base URLhttp://www.domain.com/
Base Link URL{{unsecure_base_url}}
Base Skin URL
{{unsecure_base_url}}magento/skin/
Base Media URL{{unsecure_base_url}}magento/media/
Base JavaScript URL{{unsecure_base_url}}magento/js/

Base URLhttp://www.domain.com/
Base Link URL{{secure_base_url}}
Base Skin URL
{{secure_base_url}}magento/skin/
Base Media URL{{secure_base_url}}magento/media/
Base JavaScript URL{{secure_base_url}}magento/js/

8. Save the changes and your done.

Just gone through these instructions and everything worked fine.  Even down to the upload and browse buttons disappearing.  I followed Ontic instructions on how to get these back and that worked as well.  So all in all this is a good method on how to achieve this.  However, because I had to edit the core code, I do not think this is wise.

I for instance need another shop using Magentos multi shop features and I am now worried that the solution above will cause issues in a multi shop environment.

So I think we should keep this thread going until someone has a solution to this problem.

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
ontic
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2009-09-09
 

@Sistemi Informativi - You have screwed something up, try a fresh install and follow my instructions, you shouldn’t have to edit Mage.php

@albertramsbottom - I’m glad to hear you got things up and running. If you followed my instruction correctly then you shouldn’t have any problems using Magento in a multi-website/store environment (I’ve used this setup with multiple websites and stores using individual domains, without any problems). What issues are you having? I may be able to help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
albertramsbottom
Sr. Member
 
Total Posts:  78
Joined:  2010-12-20
 
ontic - 25 January 2011 02:34 AM

@Sistemi Informativi - You have screwed something up, try a fresh install and follow my instructions, you shouldn’t have to edit Mage.php

@albertramsbottom - I’m glad to hear you got things up and running. If you followed my instruction correctly then you shouldn’t have any problems using Magento in a multi-website/store environment (I’ve used this setup with multiple websites and stores using individual domains, without any problems). What issues are you having? I may be able to help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
albertramsbottom
Sr. Member
 
Total Posts:  78
Joined:  2010-12-20
 
ontic - 25 January 2011 02:34 AM

@Sistemi Informativi - You have screwed something up, try a fresh install and follow my instructions, you shouldn’t have to edit Mage.php

@albertramsbottom - I’m glad to hear you got things up and running. If you followed my instruction correctly then you shouldn’t have any problems using Magento in a multi-website/store environment (I’ve used this setup with multiple websites and stores using individual domains, without any problems). What issues are you having? I may be able to help.

Well I went on with my multistore thing and got stuck.  I have actually posted another for some help on this issue

http://www.magentocommerce.com/boards/viewthread/218219/

My site just always go’s to the default main domain whatever I do

Cheers for all your help

 
Magento Community Magento Community
Magento Community
Magento Community
 
provoscooter
Jr. Member
 
Avatar
Total Posts:  28
Joined:  2008-06-05
Utah
 

I’ve been using this setup for a long time but I just updated to 1.4.2 and I can’t get the downloader link to work without creating a symlink from the root.

I did change the line involving the downloader in the index.php file.

Any thoughts?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top