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
Im trying to add Url rewrites in my magento store, Enabling it from configuration is not working.
How to setup Url Rewrites in Magento.?
Do I need to manually change all the url keys of thousands of products in my store.?
Thanks for the help in advance.
Have a look on this extension for free provided by Inchoo -
https://github.com/ajzele/Inchoo_UrlRewriteImporter
This extension will enable you to bulk import URL rewrite.
No, after creating and product or category magento automatically creates url-key for the same.
You can create it by indexing also.
And if there is any issue with url keys then use following steps
Go to database
Take backup of url_rewrite table
truncate the table
Reindex from index management.
Thanks
It's hard to say exactly the answer for your question since it depends on the rule you are going to apply for your products's URLs.
Hope the following information can help:
Each Magento Product has a URL-key as an attribute of product. You
can see it in Edit Product area.
These keys are also indexed
for routing purpose, and you can see all rewrite rules in URL Rewrite
area.
I have a website at present, let us assume www.TheShop.com, which is running on Martjack. Which is a sucky E-Commerce Platform, made in .net. It has a long url structure and the examples can be seen on:
http://www.thebodyshop.in/Products/Skincare-Treatment/TEA-TREE/Tea-Tree-Oil/pid-3368697.aspx
This URL Structure is really complex.
Now I am moving to Prestashop and it has simple url structure.
Question: I need to forward the links of individual products to the new product pages on prestashop. And I could only come up with the following solutions:
Individually forward the links (HOW? I HAVE NO IDEA!)
Use some module which has been made for prestashop which helps me out.
In some way use the pid given at the end of the products for re-routing to the new product pages.
301 Redirect rule can be used, but something else will be more useful as playing with .htaccess is a little risky.
I would like to get suggestions on how to go about the whole situation.
According to some SEO Practices having long URL is not good.
Magento uses layered navigation and when you have lots of attributes then the URL becomes very very long.
I can not put an URL here because the moderatos say its too localized.
I just wanted to know if this is possible to fix using any kind of code?
As I am not an expert on magento or php, I can not provide any code because I dont even know where should I start looking for to fix this.
Somebody suggested editing filter.phtml and put rel=nofollow.
Is it a good practice? Is it recommended that search engines dont crawl those pages that are related to layered navigation?
Another problem they have is that the title and description its always the same.
This is the technical solution:
Copy filter.phtml from app/design/frontend/base/default/template/catalog/layer to the equivalent directory in your site's theme.
In the anchor tag there (should be only one) add a rel="nofollow" attribute.
However, I would expect first that a SEO expert tell us if this should be done this way or not.
You might also consider using a rel="canonical" to point back to the main category that lists all of your products, that way more "juice" is sent back to that page for ranking.
More on that here: http://www.google.com/support/webmasters/bin/answer.py?answer=139394
Another solution would be to add the site to Google Webmaster Tools and then adjust how Google treats certain query string variables. By default, Google (and presumably others) examine pages with certain query string variables and try to determine if the page is different enough to rank separately or only rank the most relevant page.
Thank you very much for your post, for help I created a module that solves this error.
https://github.com/jruzafa/Devopensource_LayerCatSeo
Why don't you read YOAST Magento SEO article?
YOAST Magento SEO
Wordpress related
Multiple hostnames for a single Wordpress blog to control displayed post categories
Can it be done?
If not, why not
Else, how may I? :3
I'm trying to maintain a single blog but only show posts from a particular category for a certain host name :/
I found http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category but it's not going to change the domain in links, etc :/
Thomas - there are a few ways you could achieve this. If you want a solution that doesn't involve setting up a separate WP network for each hostname (assuming you're using WP 3.1), a neat way might be to rewrite the URL at the web server. WP already requires you to cofigure rewrite rules for pretty URL support, so there's no reason why you could internally map category.example.com into www.example.com/category. If you made all your site's links relative, this could work reasonably well.
Otherwise, I'd create a network for each hostname, and write a multi-site plugin that adjusts the WP_Query for any request received on a 'category' network, to retrieve posts from the main blog with a category filter. But you'd probably end up fighting WP every step of the way :-)
There may be a neater solution.