Jump to content

HOW TO : rewrite the TAGS urls


Recommended Posts

  • 2 weeks later...
Hello Users

i want to rewrite the tags URLs

/shop/search.php?tag=Egypt+Tours

to be:

/shop/tag/Egypt+Tours

Regards


hmm
i think that better way for that will be somethink like this (of course for robots and positioning)

/shop/tag-Egypt+Tours.html

in htaccess you should put somethink like this:
RewriteCond ^tag-(*.)\.html$ search.php?tag=$1 [here some optional params]

Of course you need to change a bit BlockTag for this

edit:
i make it on my site now:
1. make a backup
2. edit modules/blocktags/blocktags.tpl
3. change in line 7
        {$tag.name} 


to

{$tag.name}



4. make a backup .htaccess
5. add line at the end of file:

RewriteRule ^tag-([a-zA-Z0-9-]*)\.html$ search.php?tag=$1&%{QUERY_STRING} [L,E]



thats all

you can check how it works on my site http://pro-adventure.pl (still on original theme, but i plan to change all)

Link to comment
Share on other sites

2 ramires

Can you tell me please, what should I do if I get links like this:

http://xxxx.ru/presta/tag/% D0% BB% D1% 83% D1% 87% D1% 88% D0% B8% D0.html
(with no spaces after %, I've added spaces because on this page the letters are OK)



after i've changed .htaccess and blocktags.tpl?

This is encoding problem, as i understand. English letters in tags work great, but if i put cyrillic, i have above problems. I changed blocktags.tbl line 7 to:

{$tag.name|escape:htmlall:'UTF-8'}



But still getting same problems...

Link to comment
Share on other sites

2 ramires

Can you tell me please, what should I do if I get links like this:

http://xxxx.ru/presta/tag/% D0% BB% D1% 83% D1% 87% D1% 88% D0% B8% D0.html
(with no spaces after %, I've added spaces because on this page the letters are OK)



after i've changed .htaccess and blocktags.tpl?

This is encoding problem, as i understand. English letters in tags work great, but if i put cyrillic, i have above problems. I changed blocktags.tbl line 7 to:

{$tag.name|escape:htmlall:'UTF-8'}



But still getting same problems...



You need to change to latin chars before link/tag is generated.
Without this your shop will not generate good tags/links.
preg_replace() use to clean the chars and convert it as htmlspecialchars or else ... in cyrilic i think that can be a problem with that so i suppose that without deeper changing of code you will not get expected result.
Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...