Troubles after installing Two stores with same php docroot - magento

I am trying to setup multiple stores within same hosting account and I studied many interesting guides out there on the matter.
Seems to me I figured out simplest solution for me - map both my dot com sites onto the same directory on host, and modify .htaccess to launch different website depending on URL, like so:
SetEnvIf Host .*anatscraftonia.* MAGE_RUN_CODE="anatscraftonia";
SetEnvIf Host .*anatscraftonia.* MAGE_RUN_TYPE="website";
My first store works fine, but when I go to anatscraftonia.com , all I get always is a Magento 404 page.
I checked all settings, multiple stores are defined and code above is copy/paste from Admin console under Website I added. I have Home page enabled for All Stores and Base URL redefined for both Secure/Unsecure. I also tried changing website to store, with no improvements.
What else am I missing? How do I even know what page is it trying to go to, or whether it even gets “no-route” or just totally whacked…

I threw together some quick and dirty code a few years ago to log the controller dispatch process in Magento Community 1.3x.
http://alanstorm.com/magento_controller_dispatch_logging
I don't think you'll be able to drop those files into a current installation, but it should give you an idea where to stick some logging functions to see why Magento is routing to a 404.

I am not 100% sure what you are trying to achieve but why not use a single instance of magento to handle both stores and magentos own multi store capability..
full details here http://dx3webs.com/front/2010/08/magento-multistore-setup-under-plesk/ post contains links to cpanel instructions as well.
the instructions are for multiple domains but will work with sub folders

Related

Joomla com_users component unable to load some templates

I have modified the users component of Joomla, specifically the file components/com_users/controllers/profile.php and included some custom templates in components/com_users/views/profile/tmpl
It is mostly some forms which I am submitting and then redirecting to specific pages for further actions.
Example scenario :
Above option is accessible to user right after login. I have put it on the profile page by modifying default profile template.
So when someone enters a name, and presses search, then this form is submitted through form
action="<?php echo JRoute::_('index.php?option=com_users&task=profile.selectSendMessage'); ?>"
This in turn calls the function named selectSendMessage which is placed in profile.php file. The function looks like :
As you can see the function redirects to
index.php?option=com_users&view=profile&layout=sendMessage
I have placed sendMessage.php template in com_users/views/profile/tmpl
Everything works fine on localhost which I have set up on MAMP in MacOS
I moved the website to a live server a few days ago. I have followed all proper steps to migrate website and database from localhost to live server. Still any of the custom templates I have put in are never reached.
The strange thin is that Edit User Profile which is redirected to from the same profile.php file from a function edit(), with template in the same location as I have put in edit.php in views/profile/tmpl works as expected.
I am using 1and1 shared hosting plan 1&1 Unlimited for hosting the website.
I have been trying to fix this for quite some time now, but cannot understand the problem. I have tried reinstalling the website several times, tried installing from web apps from 1&1 control panel and modifying it, but no success.
Any tips and insights are welcome. Thank you.
It turns out that 1and1.com hosting somehow doesn't support layout names with a capital letter in it. I changed all layout names to lower case alphabets and everything worked fine like it should.
If someone faces the same issue, this is worth a try. It was particularly hard to debug since you will never suspect that could be a problem. I accidentally stumbled on the solution while playing around.
Thanks.

Wordpress Issues Regarding IP and Domain Name - Host Gator

I am hoping somebody can help me because I am on the verge of frustration tears.
The company I work for has a site hosted on godaddy and has to remain up until I complete the rebuild on hostgator, using the Wordpress theme, Grand Restaurant http://themes.themegoods2.com/?theme=GrandRestaurant
To get around the domain name issue since I cannot change nameservers yet, I had to use the Google Chrome plugin, Virtual Hosts, which has me input the IP and domain, to force access to the site.
Everything was working fine until I needed to use the "content builder." If you look at the Grand Restaurant theme, you can click on Menu. I need to use the "Menu Grid" option in the content builder but it does not work. Whenever I try to add the menu grid, it appears that it is trying to load (showing the gif loading image) yet in never actually loads. I have spent several days and hours going back and forth with host gator and the theme developer.
The theme developer says that the content builder does not work because:
"The WordPress URL and Site URL are set to the domain name. When you are logged in, you are being redirected to the IP, so the browser sees 2 different sites and some functionality ex. AJAX call doesn't allow you to get data from different URLs.
Your WordPress URL and Site URL settings are different from your actual site. You have to change your Domain Name URL and Site URL settings to the IP number."
I did what he said earlier today and it completely broke the site. Spent nearly 2 hours with host gator's tech support to get it back up. All tech support will tell me in regards to the content builder not working is that I need to change the AJAX file to allow the site URL and wordpress URL to be different. I have no idea how to do that!
Any wisdom you all could provide would be greatly appreciated. I have 1700 bakery items that I need upload by the end of July and I do not know what I am going to do if I cannot get the content builder working.
In order for this to work properly you should be using a method of back up and restore. By migrating from one hosting provider to another you could simply deploy the new Wordpress on host gator as a new site and import the Wordpress backup to the host gator with the many different plugins available through Wordpress. The way your trying to complete this is impossible and usually will only work with images and back ups being managed on virtual machines, and VPS. It won't hurt anything on the original up and running site. You mentioned that host gator was able to get the site back up? You shouldn't have to rebuild this if you use a back up and restore method. Everything should fall right into place, you can also test these methods through virtual box, and VMware virtualization products which offer trial versions. Try using a migration method and see if the conflicts still persist with the content builder.
Heres is what I would do if you cannot change the domain over but still use the domain for the dev environment.
Modify your hosts file and use hostgators IP and the company domain as the entry.
Install wordpress to the current company domain by simply entering the domain (Should go to hostgators server since you've added that entry in your hosts file)
With the hosts file modification, you should be able to view the wordpress site thats hosted with hostgator using the live domain name.
This way, when you're launching, theres no need to do any modification on wordpress. Simply change the DNS over, revert your hosts file and the site will swap over seamlessly.

Magento: ?___SID=U appearing in some urls

Can someone please explain why ?___SID=U is appearing in some Magento URLs on my site and not others?
I think it has something to do with sessions but I am not entirely clear. Also, what makes it more confusing is the fact that it's only appearing in some URLs and not others.
I don't need to know how to remove it as I am aware of the setting in the admin area. I would really like an explanation of what it is, what its purpose is and why it would show on some pages and not others. id rather understand what's going on fully than blindly follow some advice as to how to remove it.
I addition to Brendan's answer, the ___SID=U is used in the cache as a placeholder for the session ID. It is replaced by Mage_Core_Model_Url::sessionUrlVar() which in turn calls Mage_Core_Model_Url::sessionVarCallback(). These methods are called from Mage_Core_Block_Abstract::_afterCacheUrl(), which means that any URL found in block output will contain the correct session ID (if needed).
So to get rid of the parameter in your own code the "right way" use this:
$url = Mage::getUrl('some/magento/route'); // might append ___SID parameter
$url = Mage::getModel('core/url')->sessionUrlVar($url); // process ___SID
If the string still displays in the rendered page that is a bug. Are you using some custom caching module, or generating URL's using a non-standard way?
The SID is a "session ID". Magento uses this to track a user's activity within the same Magento installation. Normally, Magento powers one website and one store from one installation (database).
Magento could power multiple websites with multiple stores from one installation though. The SID allows users to stay logged in while navigating across these websites/stores.
I think if you have the function enabled, the SID is sent when accessing catalog URLs so Magento can update the session with the user's location/state for the current website/store.
If you're not running a multi-website or multi-store environment, it's safe to disable the SID on the frontend.
Just something i come across today and though i make a comment, maybe it will help someone.
I found that Magento will format/create an incorrect product url (inc. Session Id) if there were some errors during processing the page. This is not consistent though.
It worth having a look at your server logs for PHP errors.
This is a general Magento 2 bug which is already reported to magento.
Temporary fix is
Go to Document Root,
Find .htaccess and add
RewriteCond %{HTTP_HOST} ^abc.com
RewriteRule ^(.*) www.abc.com/$1 [L,R=301]
below.
This should solve the issue. For me this work in M2.1
All the best.
Reference : https://github.com/magento/magento2/issues/5517
I hunted for hours to find this and the precise answer was a combination of the other answers listed here. First, I cranked up my PHP error reporting and error logging (thanks Gergely Varga). I saw this:
PHP Fatal error: Call to undefined function mb_strrpos() in /var/www/html/app/code/local/ManaPro/FilterAjax/Model/Observer.php on line 59
So, one of our installed extensions requires the php-mbstring package, which my server didn't have installed. As soon as I installed that, the SID=U URLs all disappeared. (In future I'll be running Magento's pre-install checks before copying an existing install over to a new server!)
Thanks to Vinai too for the background of what this tag is for.
Go to Store > Configuration > General > Web > Session Validation Settings > Use SID on Storefrontand and set the value to No.
Clear the Magento cache

Magento : CMS upload image fail silently

I am trying to figure out why the tinyMCE WYSIWYG editor in the CMS module of Magento will not upload images. I can create/delete folders but any file will simply not get uploaded, and there seems to be no message as to why the file is not successfully written on the server.
Anyone may have an idea why?
** Update **
I'm using Magento 1.6.2. I have tried to track down the problem and it seems that the controller never gets executed. I have added a line to log the arguments in the uploadAction() action (in Mage_Adminhtml_Cms_Wysiwyg_ImagesController) and nothing gets logged.
This is project inherited from someone else, and was modified to some extend, but nothing seems to point out that this part of Magento would have been touched in anyway by the modifications.
** EDIT**
The project associated with this question has been dropped and I no longer can provide an answer to this question. If anyone can confirm a working answer (as this problem was apparantly common with Magento), I will gladly mark that answer as "accepted".
Otherwise, I will flag this question for removal for the aformentioned reasons.
Thank you.
Other than solutions provided here, it may occur when you use a CDN (or a different domain) for your javascript and media files in admin panel. If you use CDN, use it for your website(s) scope and use your own domain for default scope. It will make your website(s) media and javascript files to be loaded from CDN, and backend's media and javascript files to be loaded from your own domain. This will solve your problem.
There are some known issues with flash image uploader on Magento. Unfortunately when it falls, it falls silently. Here are some cases when smth can break it:
if you try to use it with secured connection using open ssl certificate
if you're using it on server with apache authentication
on some Magento versions with prototype 1.7
I think the latter is your best bet. Maybe you should try to apply the patch from here: http://www.magentocommerce.com/boards/viewthread/4348/P45/#t327010
In my case it was a cross domain problem, and one quite hard to find if you ask me...
What was puzzling me was that the uploader for product images was working like a charm but the one in the CMS section was failing completely silently. We are serving the skin folder from an Amazon S3 bucket, and the flash uploader lives under that folder.
Interestingly enough, our version of Magento (1.7.0.2) is using two different methods to calculate the path to the SWF file, depending whether you are under CMS or Product update.
The CMS file (app/design/adminhtml/default/default/template/cms/browser/content/uploader.phtml) is using the following method to embed the Flash Uploader:
<?php echo $this->getSkinUrl('media/uploader.swf') ?>
While the Product image uploader is using:
<?php echo $this->getUploaderUrl('media/uploader.swf') ?>
In our case, the first one resolves to the AWS S3 url, obviously in a separate domain, while the second one will still reference the local domain's url.
So yeah, the quick, dirty fix would be to replace getSkinUrl for getUploaderUrl in app/design/adminhtml/default/default/template/cms/browser/content/uploader.phtml. Alternatively you can extend the core to load a different template in which you would have replaced that method.
I hope this helps somebody... I wish I had found something like this five days ago when I first stumbled upon the issue :-)
Are you using flash uploader with https? If so, is your secure address in differente domain (usually used in shareds ssl)?
I got some trouble with this. I solved by installing a flash uploader disabler plugin.
You can download the plugin with this downloader key:
http://connect20.magentocommerce.com/community/Dull_Uploader
I hope it helps.

why my IgnoreRoute does not work?

I want to prevent users access for my "~/Content/..." folder I wrote it as follow in "Global.asax.cs" and put this line of code at the top of every other routes
routes.IgnoreRoute("Content/{*pathInfo}");
but it does not work. in fact user can see every files in content folder by type the URL in browser.
am I missing something?
How did you figure out that it does not work? Give example.
You may have put it last in the Routing table. So try to move it up so that it gets added to the routing table first. The route collection is an ordered list of routes.
Also try this : Routes.IgnoreRoute("Content/");, but your version of ignore is also correct and it should work.
Lastly, I do not know what you mean when you say the user can see all the contents of the Content folder : Isn't that the point? User must be able to download files from the folder, and we usually just need MVC to ignore the requests from coming into the framework, and so that IIS can directly serve those files.
or did you mean Directory browsing is enabled, and you want to disable that : In that case go to IIS manager, and select your website and look for the Directory browsing option and disable it as shown here.
Your problem cannot be solved by routing constraints. There are 3 significant steps in processing request:
IIS got request.
IIS watch at filesystem and search for direct correspondence to file
If IIS didn't found any file - it gives request to ASP.NET MVC for processing.
So, you need to configure folder security to forbidden direct access to files, but allow access to application, as here.
But I don't recommend to secure folder, that should be shared. I don't believe that your site shouldn't have images to display :) If you have some secured content, you need to create another folder.

Resources