Page 1 of 2
Replace spaces(%20) for multiple word tags in url
Posted: Fri Apr 14, 2017 5:20 pm
by rax
By default, multiple word tags look like this /tag/new%20car%20videos/
The url would look better using hyphens /tag/new-car-videos/
Is using mod_rewrite/RewriteRule the only way to accomplish this or is there another option?
Re: Replace spaces(%20) for multiple word tags in url
Posted: Sat Apr 15, 2017 7:43 am
by admin
You can replace spaces with dashes in templates
Script will recognize it anyway
Re: Replace spaces(%20) for multiple word tags in url
Posted: Sat Apr 15, 2017 3:22 pm
by rax
How would this be done in templates?
Re: Replace spaces(%20) for multiple word tags in url
Posted: Sat Apr 15, 2017 4:56 pm
by admin
You can use str_replace() php function
Also don't forget about tag_prefixes
Re: Replace spaces(%20) for multiple word tags in url
Posted: Sat Apr 15, 2017 5:10 pm
by rax
What tag_prefixes should be used?
Re: Replace spaces(%20) for multiple word tags in url
Posted: Sat Apr 15, 2017 5:42 pm
by rax
Also, can you show an example here, the space(%20) in tags doesn't exist until the <!--TAG1--> is already processed by the server. So how would we use str_replace() to make this work?
Re: Replace spaces(%20) for multiple word tags in url
Posted: Sun Apr 16, 2017 6:01 am
by admin
I mean you can use it right in templates
Re: Replace spaces(%20) for multiple word tags in url
Posted: Sun Apr 16, 2017 3:40 pm
by rax
Can you please show me an example of how this would work using str_replace() php function and tag prefixes? I don't see how this could work as the <!--TAG1--> variable hasn't been processed yet by the server to show the actual tag, again the url example I'm using is domain.com/tag/new%20car%videos/
Re: Replace spaces(%20) for multiple word tags in url
Posted: Mon Apr 17, 2017 2:29 am
by admin
<!--TAG1--> becomes <? echo str_replace(' ', '-', '<!--ESCAPED_TAG1-->') ?>
Re: Replace spaces(%20) for multiple word tags in url
Posted: Mon Apr 17, 2017 5:22 am
by rax
Thank you.
I had tried using that code with '%20' in the single quotes, didn't think to try the ' ' blank space...