Forums / Developer / Strip folders with mode _rewrite for better Search engine pages

Strip folders with mode _rewrite for better Search engine pages

Author Message

Romeo Antony

Friday 07 January 2011 10:39:53 pm

Hi ,

I would like to set up search engine friendly URL with ezpublish site. For that I know apache mode_rewrite is the best solution . I read from many places that badly configured rewrite rules can make low perfomance in serving pages. rewrite rules conflicts etc.

My ezp is configured to work in virtualhost setup as mentioned in ezp documentation .I have put new a rewrite rule in virtualhost configuartion block. Can anyone pleae tell me these rewrite rule may brings up any conflicts with existing rewrite rules in the virtualhost set up.

All the articles are placed subfolder stories

http://mydomain.com/archive/stories/all artciles are placed here.

But the problem is that , google searches showing the articles title as

article title/stories/archive. (bez of article is placed under archive/stories)

But , I need to show only article title instead of article title/stories/archive.

To eliminate above to get better search engine friendly urls,

I should rewrite the all urls to

http://mydomain.com/article title. (rewrite rules elimaminates archive/stories)

Following is the rewrite rule.

<b><span class="line">RewriteRule ^/archive/stories -</span></b><span class="line">


Anyone thinks that above rewrite rule bring up any conflicts or any issues ? ABove rewrite rule 
can strip archive/stories/ from evey page request

Please give me some ideas.



</span>

André R.

Saturday 08 January 2011 11:12:38 am

You should probably just modify the code that generates the title tag, that is normally what most Search engines use as title.

If webin/flow it's in page_head.tpl

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Romeo Antony

Monday 10 January 2011 12:10:49 am

Thanks Andre. It worked.

Fetch the first item from the reversed path to the target node by offset=0 and max 1.

{set-block scope=root variable=site_title}
{section loop=$Path:reverse_path max=1 offset=0}{$:item.text|wash}{delimiter} / {/delimiter}{/section} - {$site.title|wash}
{/set-block}

Regards

Romeo.