Keyword

Redirect automatically URL with /item/ in the URL

  • lukass2000
  • lukass2000's Avatar Topic Author
  • Offline
  • Senior Member
More
1 year 1 month ago #181323 by lukass2000
Hello,
I found this post here in the forum
With the information at the end of @Chandan Kumar, it works wonderfully for me with Joomla v3.10.12 and K2 v2.11

Login into Joomla! 3 Administration Console
Click on Components>>K2
Click on Parameters
Click on Advanced tab
Enable advanced SEF for K2 URLs and make your settings as attached below.

Now the my test URL 
blog/test-folder01/item/1078-test-article01.html
looks like this
blog/test-folder01/test-article01.html

this is great and works wonderfully 
But now both URL variants work, and I think there is so much double content for SEO, which is not good :(

Is there a way in K2 or via .htaccess to redirect the “old” URL automatically from
blog/test-folder01/item/1078-test-article01.html
to
blog/test-folder01/test-article01.html

So in the future, only the new and nicer URLs will be used, but the old ones would then have to redirected automatically.
Is there a possibility?

THANKS :)

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #181524 by ThomasCardle
Replied by ThomasCardle on topic Redirect automatically URL with /item/ in the URL
Using .htaccess file: If you prefer to use the .htaccess file, you can add the following code below the line that says # Begin - Custom redirects:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^option=com_k2&view=item&task=item&id=([0-9]+)&Itemid=([0-9]+)$ [NC]
RewriteRule ^$ /blog/test-folder01/%1? [R=301,L]

This code will redirect any old K2 URL that matches the pattern &view=item&task=item&id=XXX&Itemid=YYY to the new one that matches the pattern blog/test-folder01/XXX, where XXX is the item ID and YYY is the menu item ID.

Please Log in or Create an account to join the conversation.

More
5 months 3 weeks ago #181696 by Verewgas
Hi,

seems to be solved changing 0 to 1 in the database.

Regards

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum