Forum Moderators: phranque

Message Too Old, No Replies

rewrite seo friendly URLs

         

directorioweb

3:33 pm on Aug 30, 2012 (gmt 0)

10+ Year Member



Hello,

I would like to ask how can I rewrite my website's internal pages in order to be seo friendly. For instance I would like to convert this type of URL:

website.com/search/where_search/barcelona/search_category/1/
website.com/search/where_search/barcelona/search_category/1/page/2/

to

website.com/category-name/barcelona/ or ../barcelona.html
website.com/category-name/barcelona/1/ or ../page1.html

I already tried several configurations with no success. Any help is appreciated.

g1smd

3:55 pm on Aug 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You'll need to link to the URL format you want users to see and use from the other pages on your site.

What code have you tried so far? URL rewriting questions come up several times per week, so there are several thousand previous threads with example code.

directorioweb

4:59 pm on Aug 30, 2012 (gmt 0)

10+ Year Member



Ok, I can do that for other links in the page but for the search button it might just be too complicated. I used this kind of codes:

RewriteRule ^search/category-name/barcelona/([0-9]+)/([0-9]+)/(.*?).html$ /search/where_search/barcelona/search_category/1/

For instance, other URLs I have are:
website.com/types/category-name/

which I would like to convert to
website.com/tipos/category-name/ by just translating the word types to tipos.

So in this case, I could change the link structure in header.tpl but i don't know how to build the .htaccess rule.

header.tpl containing the menu is:
<!-- Menu Starts -->
{if !$system_settings.single_type_structure}
<div id="menu">
<ul>
{assign var = i value = 0}
{foreach from=$types item=type}
<li><a href="{$VH->site_url($type->getUrl())}" class="{if $type->id == $current_type->id}active_type{/if}">{$type->name}</a></li>
{if $types|@count != ($i++) + 1}
<li>|</li>
{/if}
{/foreach}
</ul>
</div>
{/if}
<!-- Menu Ends -->

lucy24

6:57 pm on Aug 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When you say "search button" are you talking about an internal search, or something that always leads the user to one individual page?

If you've got an internal search page, you may not want it indexed at all. If it has to be indexed, tell the major search engines which parameters to disregard.

I would like to convert this type of URL:

website.com/search/where_search/barcelona/search_category/1/
website.com/search/where_search/barcelona/search_category/1/page/2/

to

website.com/category-name/barcelona/ or ../barcelona.html
website.com/category-name/barcelona/1/ or ../page1.html

<snip>

RewriteRule ^search/category-name/barcelona/([0-9]+)/([0-9]+)/(.*?).html$ /search/where_search/barcelona/search_category/1/


Try not to use words like "convert" or "change" in the Apache forum. They just make everyone more confused. It's better to say something like:

I want the URL to be {name here}

the old URL was {name here}

the content is at {"real" location here}

Items 2 and 3 might happen to be the same, but this won't affect your rewrites. In any case your html has to point to the current URL that you want people to see and use. Redirects are only for people following outdated links or bookmarks that are out of your control.

Now go read the post about using "example.com". It's at the top of this Forum. You can say "example.es" if you prefer. It just has to be "example".

directorioweb

1:33 am on Aug 31, 2012 (gmt 0)

10+ Year Member



Thanks. Great to find out that example.com is actually not commercial.

Yes, there is a search engine in the website, but I would only want to build the rewrite rule for some 40 links containing searches and get those internal pages indexed in google.

Like a website with used cars for sale, where they build SEO urls for regions to rank good in search engines:

example.com/cars-for-sale/barcelona
example.com/cars-for-sale/madrid

and so on for each region. Then they place new links in footer or elsewhere in the site "cars for sale in Barcelona" and so those internal pages containing a search would rank at their best. So, in this particular case, there would be no need to modify any link, just make the rewrite rule work for the new links.

So, both options would work: example.com/search/search_where/barcelona/search_category/1/ when you use the websites search engine and example.com/cars-for-sale/barcelona/ when accessing through the new links and eventually throught google when indexed. That's what they all do :-(