Magento 1.4 url rewrites in multi store environment - php

Long story short - I'm trying to restore my ver1.4 store (multi-store) but am doing so to a test environment first. (Production has one site working and I don't want to lose it entirely.)
On my test environment, I continue to get the following error message when I try to reindex the Catalog URL Rewrites:
An error occurred while saving the URL rewrite.
Before doing that, I had emptied the core_url_rewrites table in the database, cleared the var/cache, var/locks and var/session folders and cleared my browser cache.
I've done it repeatedly to see if I could figure out what was going on. I had read that there was often a problem with url rewrites in multi-store setups when products were in more than one root category. I had a lot of those, so I went through my cata.logs and products and limited each product to just one root category (store/domain.)
My configuration settings are as follows:
System -> Configuration -> Web
URL Options
Add Store Code to Urls No [GLOBAL]
Redirect to Base URL if requested URL doesn't match it No [GLOBAL]
Search Engines Optimization
Use Web Server Rewrites Yes [STORE VIEW] (all store views set to use Website)
System -> Configuration -> Catalog
Frontend
Use Flat Catalog Category No [GLOBAL]
Use Flat Catalog Product No [GLOBAL]
Allow Dynamic Media URLs in Products and Categories Yes [STORE VIEW]
Search Engine Optimizations
Autogenerated Site Map Enable [STORE VIEW]
Popular Search Terms Enable [STORE VIEW]
Product URL Suffix .html [STORE VIEW]
Category URL Suffix .html [STORE VIEW]
Use Categories Path for Product URLs Yes [STORE VIEW]
Create Permanent Redirect for old URLs if Url key changed yes [STORE VIEW]
Page Title Separator - [STORE VIEW]
Use Canonical Link Meta Tag For Categories No [STORE VIEW]
Use Canonical Link Meta Tag For Products No [STORE VIEW]
I confirmed that I have the proper .htaccess file in each of my directories (the root and each of the folders with symlinks denoting the various stores/domains.) I also double-checked my index.php files.
Each time I run the Reindexing, it indexes one more item. I have over 2500 items so am inclined to not want to go through it 2500 times. I feel I must be missing something, but I can't figure out what it is.
When I add a new product, it usually gives me an error message that it failed because it couldn't create a url rewrite, but the item is added. Then the next time I reindex, the new item is indexed for all four stores.
This didn't seem to be a problem with my previous setup so it might simply be the goofy way that my test environment is set up.
If anyone has any ideas of how I might identify and/or fix the problem, I'd be MOST appreciative!
Cheers!
Penny

Need more information about the error message. Look in the var/log folder or var/report folder for further information on the exact error and hopefully there is something there that will shed some light. Could be due to a variety of reasons so detailed message is required.

Related

Opencart: Multiple domains - one site / installation?

We have two domains:
the .gr
and the .com
But we want our opencart shop to be working on both of these domains
with the same products/ layout/ settings but the language
Currently our opencart is installed at .gr and uses an alias domain for the .com.
But we want a different default language for the .com
And sure you can enter from the .com domain once you click any link for example a category link it redirects back to .gr because all links pont to .gr
probably because .gr is set for the catalog url in the config
One solution is to make a second multistore entry with different catalog url and language setting
but this will require to recreate the layout and the theme settings to our site and asign the products/categories to the new store and this can be mass-done from the database.
But in maintenance a change will need to be done in both stores
Is multistore the right way?
Do you have a more efficient way to mirror our site to the .com?
We use opencart v3.0.2.0
Thanks in advance!
Domain points to some folder on server, point both domains to that one folder with opencart installation.
Now create two stores from the admin panel and in the url of store settings provide the exact url of both stores.
Opencart matches the Current Url with store settings URL and displays the store.
You can set different languages,themes and many other settings are separate for both stores, you can find those in store settings in admin panel .
Products and other data will be shared.
Even you can control if product / category needs to be shown on both or not.

301 not issued automatically in Magento

I see that if the name of a product is changed in my Magento V 1.9.2.2 shop, links from google are giving 404's for the url's with the old name instead of redirecting to the new page and getting a 301.
I know I can manually add the redirect in the URL Rewrite
Maintenance section and that does work but I'm wondering if that is how Magento works or if I am missing something? If it is how it works, it seems a big oversight on Magento's part.
Is there a known fix for this or maybe some setting I have to change? Or do I need to enter such changes in manually each time?
For create new URL Rewrite magento have Catalog URL Rewrites indexing. So when you did Catalog URL Rewrites indexing then all the URL generate properly. Have you try to indexing? Also check its on ready state or not.

Finding a page for text amends in a Magento shop

I've been asked to change some text on what appears to be a static page on a Magento powered site. The page is located at /delivery.
The /delivery URL is publicly accessible. I just don't know where it lives within the system. I'm not sure whether the page lives in a file or is being brought in through the Magento framework from a database or other.
Within the Magento Admin panel there is no Pages menu in the CMS dropdown. Furthermore, there aren't any references to /delivery in the Catalogue > URL Rewrite Management.
I have root access to the server, but the site was not built by me so I need to tread carefully. As far as I can tell there are no specific rewrites for /delivery in the Apache2 configurations. I would try a grep for a specific piece of text on that page, but the whole site is around the 20GB mark, so I would want to narrow down the possibilities first.
What other avenues of investigation would a Magento or other developer exhaust to find the text before trying to get in touch with the original developers?
If it's definately not a cms page, then try running this on shell
grep -R '<frontName>delivery</frontName>' /path/to/site/app/code/*
This should hopefully find the module using that frontname. It could be however that the module has a configurable frontname, in which case you could connect to the data base and search for the value in the table;
SELECT * FROM core_config_data where value = "delivery"
Seems odd you don't have a link to cms pages in your admin, so while you're looking at the db, take a look at;
SELECT * FROM cms_page;
And confirm the delivery page isnt living there.
If the page is infact in the cms_page table, then it becomes a question of why you cant get to the tab. First port of call would be to ask the person who created your admin account to check whether your user role has access to that particular feature, and if not, get it added.

Get rid of ID (category and article) from URL (Joomla 3.3 / 3.4 / 3.5)

I have a Joomla 3.3.6 (edited: 3.5.) site organized in only 3 levels:
Four big categories (i, ii, iii, iiii)
Each one divided in some intermediate categories (A, B, C, ...)
And finally articles
Two languages (en, pt)
The URL after setting Search Engine Friendly URLs, Use URL rewriting, Adds Suffix to URL and multilanguage support, should be in the form:
http://www.example.com/en/bigcatiii/intercatA/articlex.html
But as many others that have Joomla installed and ask for a solution since Joomla-Baby-Version, I got:
http://www.example.com/en/bigcatiii/666-intercatA/articlex.html
where 666 is a number from hell indicating for no purpose a category ID
Now browsing for an answer, I found this answer:
Edit “components/com_content/router.php“
(You’ll probably have to re-do this step every time you update Joomla.)
Replace the lines 38 and 290 with:
$advanced = $params->get('sef_advanced_link', 1);
and Replace line 426 with
->where($db->quoteName(‘alias’) . ‘ = ‘ . $db->quote($segment));
Well, first of all, line 426 is already like that in the original. Second, this does not do the trick. It do works with:
http://www.example.com/en/bigcatiii/intercatA/articlex.html
But it breaks wit a 404 error if you browse to:
http://www.example.com/en/bigcatiii/intercatA.html
Also, I noticed that the ID numbers are different. While the whole URL is
http://www.example.com/en/bigcatiii/666-intercatA/articlex.html
The same category description page is
http://www.example.com/en/bigcatiii/333-intercatA.html
There is also another solution that sound better, but also do not work, based on .htaccess
RewriteEngine on
RewriteBase /
RewriteRule (\d+)-([^/]*) $2 [R=301,L]
The URLs appear ok, but the pages are not found. It would be so much better if we can provide a solution using .htaccess instead of changing Joomla core.
Still, changing the Joomla core would just fine, if this other googled suggestion was valid.
Copy “components/com_content/router.php” to “/templates/your-template/html”
Meaning that once you moved router.php to your "local", you wouldn't need to redo all the stuff after an upgrade. (Unless, of course, router.php is updated, in case you would better mirror it again.)
Thanks for your time to solve this puzzle!
References
1- Change/ Remove Article ID in URL?
2- Removing the Article ID number
3- How to remove article id in url?
4- Remove article id from url for joomla 3.0
5- Enabling SEF
6- Remove article id from joomla 3 URL
7- Remove article id from joomla 3 URL
8- .htaccess redirect rule
9- Test .htaccess
Edited (2016/May/02): NEW Bounty for Joomla last version 3.5
I've just newly installed a joomla 3.5 and the old method works for me. Since something has been modified in the router file, you have to repeat the procedure after a joomla upgrade.
The lines are now 34 and 295 in ./components/com_content/router.php.
Again change the 0 into 1 so that it becomes:
$advanced = $params->get('sef_advanced_link', 1);
My URL is e.g. http://joomla.lan/en/category-en-gb/article-en-gb
works fine with Search Engine Friendly URLs on.
With Adds Suffix to URL switched to Yes an .html is appended to the URL.
Use URL Rewriting and Unicode Aliases work optionally. When using URL rewrite engine on IIS7 or Apache, you have to rename htaccess.txt into .htaccess and webconfig.txt into webconfig. Note that some hosters have a restrictive server configuration. If you get a 500 internal server error, you might need to edit .htaccess and comment out the lines Options +FollowSymlinks and/or Options -Indexes and/or RewriteBase / by adding a preceding #. The latter is already deactivated in Joomla 3.5. A RewriteBase setting is useful when Joomla is installed in a subfolder, not the web root.
On other servers set Use URL Rewriting to No.
I can't reproduce your problem, everything is working correct with those two code edits. Please try it out again and if you can't resolve, post the exact behavior (urls, errors aso.)
If you can not get it fixed, you might have to reinstall the sources.
After looking into it, I found some useful pieces of information. DISCLAIMER I don't use Joomla and haven't tried this on a working installation, these are only results of some searching & reading source code. Anyway, here's what I found.
From what I have gathererd, it seems that changing
$advanced = $params->get('sef_advanced_link', 0);
to
$advanced = $params->get('sef_advanced_link', 1);
should be enough. Be careful though, with this option, probably both URL (with and without IDs) will be available which isn't good for SEO. Problem is with the 404, but that seems like a problem with the Joomla routing system. You could compensate the 404s with menu links which are only configured but never used (see below).
Some origins of your problem:
For example, in their routing, they use the menu to find the category ID (Line ~385 // We get the category id from the menu item and search from there)
For each URL segment (separated by the /), they first search category aliases, so be sure to check your aliases. If they cannot find the alias in the categories, they rely on the ID in the URL for their search query (Line ~425 ->where($db->quoteName('catid') . ' = ' . (int) $vars['catid']))
When a categoryID or articleID is attached to a menu, they remove the category ID $query['catid'] because they know they have a unique global alias (Line ~69)
Therefore, one solution is to do the following:
You could try and create a menu item for each category and each article. Even if the menu is not displayed anywhere and only configured in the administration interface, it will create global unique routing aliases for categories and articles which will let Joomla find the right article/category. From what I understand, when a category or article has a menu item, then only the title aliases are used. But since they don't have any, they use the combination of id + slug to locate the resource.
Since a lot of people are complaining about this, it should be fixed in Joomla 3.5
References & Discussions:
A blog giving some solutions and explanations about this issue: http://developernote.com/2012/05/how-to-remove-id-from-url-in-joomla-2-5/
A joomla forum thread discussing your problem and it's solutions: http://forum.joomla.org/viewtopic.php?f=712&t=826165&start=30
Maybe some plugin solves this issue: http://extensions.joomla.org/extensions/site-management/sef
To finish on a bright note, it seems that the developers are aware of the limitations ;)
Joomla 3.7(?) to 3.10.5 Legacy router issue fix
Here is the solution that worked for me, on Joomla 3.10.5, but it might be the same from 3.7 up (If not fixed in 4.0).
Legacy router - path: #www/components/com_content/helpers/legacyrouter.php
Hacking the legacy router, and deactivate appending the category id to the segments array by commenting out line 199 in the legacy router and replacing it like this:
//if (!$advanced && count($array))
if (false)
Tried these solutions
Defaulting $advanced to 1 and more, and other solutions here and in this link: https://vincentping.com/en/remove-category-article-id-from-url-in-joomla-3.html did not work for me:
And more: The site article urls only needed the category id to be removed, not the article id, as removing both causes a 404
Hoping this helps someone not have to spend the large amount of time I have trying .htaccess routing, other solutions and plugins before resorting to this hack.
You can see the result here: https://new.ac-news.org (under construction)
Another easy solution is to create a menu item as category blog and use the alias as your category.
It won't delete the URL in your website but you can still send the XML site map to your search engine without those categories URL with Id's

How to make Opencart 1.5.6 urls use product name

Currently when you choose a product (Business cards) the url looks like this
http://smoothprint.co.uk/index.php?route=product/category&path=59
What would I have to change so the Url would be
http://smoothprint.co.uk/business-cards
Is the url saved in the database attached to the product?
Normally I would mark Your question as an Off Topic as it is hell clear You did not use GOOGLE before asking here... As there are many tutorials (and I believe also some similar questions regarding this here on SO).
First of all You would have to go to Your OC and rename htaccess.txt file to just .htaccess (yep, with the dot in the front)
Second, go to Your administration -> System -> Settings -> click edit Your store and on tab Server (I guess) You'll find option Allow SEO friendly URLs (or something similar) - check the checkbox and hit on Save
Now You can walk around the administration of categories, products, informations and manufacturers and all of these have an option SEO keyword (when editing/inserting one) - this field then is used for Your fancy SEO URLs...
Enjoy!
Here is a detailed tutorial about this: http://www.templatemonster.com/help/opencart-how-to-enable-and-use-seo-urls.html
Remember that just will not leave your site more "optimized" for SEO. Include data-vocabulary, unique descriptions, and internal links.

Categories