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

Trying to go live, but having problems with redirect
 
ldjones
Jr. Member
 
Total Posts:  23
Joined:  2008-04-03
 

I am getting ready to go live with our website.  However, I am having problems with with redirects from “www.mydomain.com/store” to “www.mydomain.com”.

Question first, then background.

Questions:  If I have Magento installed at http://www.mydomain.com/store, how do I “hide” the “store” part of the URL for the whole website?  And, still have Magento work correctly?

Background:  I started our website by using WordPress.  I installed WordPress at http://www.mydomain.com/wordpress, and in the system config, I set the WordPress URL to http://www.mydomain.com/wordpress, and set the Blog URL to http://www.mydomain.com.  This was a simple way to get the redirect to work for the whole site--not having “wordpress” in the URL.

But, I wanted a better ecommerce solution than the simple html front-end to PayPal that I was using.  So, I decided to go with Magento.  Now, I am wanting to go live with it and have the same type of redirect that WordPress allowed--when the user types http://www.mydomain.com, it really is going to http://www.mydomain.com/store (but not showing “store” in the URL).

Basing my thinking on what I was using in WordPress, I changed the Base URL in the system web config from http://www.mydomain.com/store to http://www.mydomain.com--ouch, that was a killer.  Wrong guess!

I looked on the forums about using the redirect in the htaccess file. I tried several of the suggestions from the posts, but things were a mess.  I finally found one post that had this for their htaccess:

DirectoryIndex index.php

RewriteEngine on 
RewriteCond 
$!^(index\.php|media|skin|js|robots|var\.txt
RewriteRule ^(.*)$ /store/index.php/$1 [L]

RewriteEngine on

RewriteCond 
%{REQUEST_URI} !^/media
RewriteCond %{REQUEST_URI} !^/skin
RewriteCond %{REQUEST_URI} !^/js
RewriteCond %{REQUEST_URI} !^/var/ 
RewriteCond %{REQUEST_FILENAME} !-
RewriteCond 
%{REQUEST_FILENAME} !-
RewriteCond 
%{REQUEST_FILENAME} !-l

RewriteRule 
^(.*)$ /store/index.php/$1 [L] 
ReWriteBase 
/

I put it in my public_html/.htaccess file and it was a little better.  Then I put it in my public_html/store/.htaccess file and things looked pretty good.  I would type in http://www.mydomain.com and my Magento store site would show up--yahoo!

However, as I would click on links, the “store” would show up in the URL.  Then when I tried to clean up my product images and add them back to the products, Magento would not always show the images properly in the images panel for the product. 

Then the real kicker is when I went to test purchasing a product.  Things were going OK until I got to the checkout page.  Only the Checkout method bar and the Billing Information bar would show--no contents for these bars and none of the other bars would show up.  I could not go on with purchase.

So, I restored my original htaccess files and Magento was working well again.  Except for the fact that the user would have to type in http://www.mydomain.com/store to really get to my store--not the desired solution.

Is there anyone that can help?

Thanks,
Larry

P.S.  my WordPress site is at http://www.neighborhoodbeekeeping.com.  My Magento site is http://www.neighborhoodbeekeeping.com/store.  Other than cleaning up a few more product images and doing the multi-browser validation, we are wanting to go live ASAP.  Also, if anyone can give any directions of how to embed gallery2 into Magento, I would really appreciate it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fibo
Sr. Member
 
Avatar
Total Posts:  107
Joined:  2008-06-25
Marseille, France
 

Seems you are trying to have any call to http://www.mydomain.com redirected to http://www.mydomain.com/wordpress/ or http://www.mydomain.com/store/ depending on some parameters.

Assuming you don’t want your store to appear as http://www.mydomain.com/store/, a safer strategy would be to use subdomains, e.g. either your blog pointing to blog.mydomain.com or your store pointing to store.mydomain.com, or both, or the other one being http://www.mydomain.com

Out of the 3 strategies blog/store, blog/www, www/store I would probably prefer blog/www UNLESS your blog has an excellent page rank and lots of referenced pages, in which case I would prefer www/store

NOTE: do lots of backups of all your htaccess files, since you’ll be doing several modifications AND every Magento update will silently overwrite your htaccess

 
Magento Community Magento Community
Magento Community
Magento Community
 
ldjones
Jr. Member
 
Total Posts:  23
Joined:  2008-04-03
 

I didn’t mention it specifically , but I am replacing the WordPress site with the Magento site.  Visitors are used to entering http://www.mydomain.com and all of our business cards, literature, etc.... has http://www.mydomain.com.  I don’t want to have to change it to http://www.mydomain.com/store.  I only brought up the WordPress to indicate how easy it is to change the redirect, and I was hoping that it was that easy with Magento.

And yes, backups have proven very necessary in trying to get this to work--very good note.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ldjones
Jr. Member
 
Total Posts:  23
Joined:  2008-04-03
 

OK, I will admit that I am new to this web development and really don’t know much about this htaccess rewrite.  Although I have seen it done.

So, with my attempts to have the rewrites/redirects for my magento site (http://www.mydomain.com/store) rewrite to http://www.mydomain.com have failed for Magento to work properly, I tried copying the contents of my store directory to the root.  Well, that didn’t work--I am guessing that there are paths already stored.

My question is it possible with Magento to do the rewrites (similar to what I have done with Wordpress), or do I need to just start over with a new install of Magneto at the root of my site?

Any help would be appreciated.

-Larry

 
Magento Community Magento Community
Magento Community
Magento Community
 
ldjones
Jr. Member
 
Total Posts:  23
Joined:  2008-04-03
 

I couldn’t get Magento to work with the htaccess rewrites.  Most everything worked except for checkout--only the Checkout method bar and the Billing Information bar would show.

However, here’s what I did to get this to work:
1) renamed my root directory, “public_html” to “public_html_bak”.
2) created a new directory, “public_html”
3) copied the contents of my Magento directory, “store”, to public_html.
4) changed the Unsecure Base URL and Secure Base URL to “http://www.mydomain.com/”.
5) however, doing this zeroed out my htaccess file.  So, I copied the htaccess file that I had saved off back to the root directory public_html.
6) then in this htaccess file, I changed the line “#RewriteBase /magento/” to “RewriteBase /” and saved it.
7) in the admin, I cleared the cache.
8) when validating the site, I found that I had some references to the “store” directory and I cleaned those up.
9) additionally, I had to clear my browser’s cache.

So far, things are working.

-Larry

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