Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:42:08+00:00 2026-06-17T04:42:08+00:00

I have set up friendly URLs for a few search result pages, using a

  • 0

I have set up friendly URLs for a few search result pages, using a custom route for each:

friendly_search_resultpage:
  url: /products/my-friendly-alias
  param:
    module: products
    action: search
    querystring: searchattribute
    querystring2: searchattribute2

This works fine, but when doing the search directly (i.e. browsing to /products/search?querystring=search...) I want to set a <link rel="canonical"> containing the matching friendly URL. This will help Google understand the relation and that there isn’t duplicate content.

I put my friendly URL route at the top of routes.yml and hoped for a magic match, but URL parameters aren’t recognised in the checking done by symfony. I have dug into sfRoute, with no luck. Is it possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:42:10+00:00Added an answer on June 17, 2026 at 4:42 am

    I ended up writing a custom routing class to use for these routes, which is executed when url_for() is called. Here is the code:

    <?php
    class mySearchFriendlyRoute extends sfRoute
    {
      public function matchesParameters($params, $context = array())
      {
        // I can't find symfony sorting parameters into order, so I do
        // (so that foo=x&bar=y is treated the same as bar=y&foo=x)
        ksort($params);
        $mine = $this->defaults;
        ksort($mine);
        if ($params == $mine) {
          return true;
        }
        return false;
      }
    }
    

    To use, add class: mySearchFriendlyRoute to the routes.yml entry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up some User Friendly URL rules in IIS7 using the URL
I have a URL which has been converted into SEO friendly url using .htaccess.But
I have my .htaccess set up to rewrite 'friendly URLs' - the first is
I have a Joomla installation with search-friendly-urls at the root level of the domain,
I have set up an SEO friendly url rewrite in IIS 6. It works
I have set up upload_max_filesize and post_max_size to 32Mb in php.ini. I am using
I have set of flat files (114 files) each file is named with database
I have set up a datepicker in a form using the following js: $(#Expiry).datepicker({
I have set onItemClicklistener on my custom list view but onItemClicklistener not working I
I have a site that functions using a language URI attribute to set language

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.