What you are describing is normally done using the so-called document root of the domain.
The document root is specified in the Apache server configuration files (e.g. when you are using PLESK it is under /var/www/vhosts/yourdomain.com/conf/vhost.conf).
In that file you would just put something in the lines of:
DocumentRoot /home/jsonderson/pulic_html/mydomain
and then restart the web server to load the new configuration.
Afterwards, the domain.com will point exactly to that folder and that is all you have to do.
Have a look at the apache virtual host configuration: http://httpd.apache.org/docs/current/vhosts/examples.html
Programmatically speaking, the category page will return a noRoute/404 page when the call to _initCategory
returns false.
#File: app/code/core/Mage/Catalog/controllers/CategoryController.php
if ($category = $this->_initCatagory()) {
//...
}
elseif (!$this->getResponse()->isRedirect()) {
$this->_forward('noRoute');
}
The _initCategory
method returns false for three reasons
When a category id can't be extracted from the request,
#File: app/code/core/Mage/Catalog/controllers/CategoryController.php
$categoryId = (int) $this->getRequest()->getParam('id', false);
if (!$categoryId) {
return false;
}
When the catalog/category
helper's canShow
method returns false,
#File: app/code/core/Mage/Catalog/controllers/CategoryController.php
if (!Mage::helper('catalog/category')->canShow($category)) {
return false;
}
When an observer of the catalog_controller_category_init_after
event throws an exception
#File: app/code/core/Mage/Catalog/controllers/CategoryController.php
try {
Mage::dispatchEvent(
'catalog_controller_category_init_after',
array(
'category' => $category,
'controller_action' => $this
)
);
} catch (Mage_Core_Exception $e) {
Mage::logException($e);
return false;
}
The canShow
method mentioned above returns false for three reasons.
If the category has no id,
#File: app/code/core/Mage/Catalog/Helper/Category.php
if (!$category->getId()) {
return false;
}
The category's active property is set to false
#File: app/code/core/Mage/Catalog/Helper/Category.php
if (!$category->getIsActive()) {
return false;
}
Or the category isn't in the root category list
#File: app/code/core/Mage/Catalog/Helper/Category.php
if (!$category->isInRootCategoryList()) {
return false;
}
Some quick temporary debugging code in the above files should get to the bottom of your problem.
If viewAction
method isn't being called, it means your rewrites aren't being created. If you're using Commerce Bug (my commercial Magento debugging extension) the Request tab will quickly tell you which controller action method is being called.
Best Answer
See Magento build in url rewrites catalog section: