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

  • SEARCH
  • Home
  • 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 7410161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:11:26+00:00 2026-05-29T06:11:26+00:00

This url structure is proposed for SEO optimization. So suggesting another structure will not

  • 0

This url structure is proposed for SEO optimization. So suggesting another structure will not work. Structure proposed is

example.com/<language>/<country>/<province>/<city>/<product>

example.com/en/spain I wish to point to CountryController indexAction , as view of each one is different, and sometimes think there is change in layout also.

Show the content in English language about the country Spain. And for a request example.com/en/india should show about India in English language and example.com/es/spain should show the spanish page for the country Spain.

example.com/en/spain/barcelona Points to CountryController provinceAction

Content Page for the Barcelona province of Spain in English Language .

example.com/en/spain/barcelona/barcelona Points to CountryController cityAction

Content Page for the Barcelona city in Barcelona province of country Spain in English Language .

example.com/en/spain/barcelona/barcelona/taxis Points to CountryController productAction

Content Page for the product in Barcelona city , Barcelona province of country Spain in English Language .

Yes we can add a route like

$router = $ctrl->getRouter();
$router->addRoute(
    'country_spain',
    new Zend_Controller_Router_Route('spain',
                                     array('controller' => 'country',
                                           'action' => 'index'))
);

But in this case we need to add the whole list of countries to the route. ie india , china , pakistan , unitedstates etc .

Then will be adding country_province

$router = $ctrl->getRouter();
$router->addRoute(
    'country_spain_barcelona',
    new Zend_Controller_Router_Route('spain',
                                     array('controller' => 'country',
                                           'action' => 'province'))
);

So if we have 50 province it will be horrible to add count of countries multiplied by count of provinces for the countries , and this will become more routes when moving to city and products.

You may say add something like

$router = $ctrl->getRouter();
$router->addRoute(
    'country',
    new Zend_Controller_Router_Route('country/:country/:province/:city/:product',
                                     array('controller' => 'country',
                                           'action' => 'index'))
);

But in this case its like we will be pointing to same action, but as the view of the requests change, and this will become a fat controller .

The problem with Zend_Controller_Router_Route_Regex is we should have something like
example.com/en/country/spain/barcelona/barcelona/taxis and also the all moves to a single action. As the view is entirely different, it becomes dirty. May be something like partials I can use. But I wonder whether there is another good solution for the problem to solve this. This is a legacy project, so I have limitations on it and #ZF version is 1.6.

There is an example something similar

http://www.travelportal.info/
http://www.travelportal.info/asia
http://www.travelportal.info/asia/india
http://www.travelportal.info/asia/india/business-currency-economy

How do you think, they have done this, will they have added routes atleast for asia , europe like that ?

I was able to make it work like

example.com/en/spain Pointing to CountryController indexAction

example.com/en/spain/barcelona Pointing to CountryController provinceAction

example.com/en/spain/barcelona/barcelona Pointing to CountryController cityAction

example.com/en/spain/barcelona/barcelona/taxis Pointing to CountryController productAction

But there I need to add 4 routes and this will become hard to manually add the route like this.

Suggestions and criticisms are welcome to make it better.

  • 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-05-29T06:11:32+00:00Added an answer on May 29, 2026 at 6:11 am

    It seems like you want a separate route for each of your example scenarios, e.g.:

    $router->addRoute(
        'product',
        new Zend_Controller_Router_Route(':lang/:country/:province/:city/:product', array(
            'controller' => 'country',
            'action' => 'product'
        ))
    );
    
    $router->addRoute(
        'city',
        new Zend_Controller_Router_Route(':lang/:country/:province/:city', array(
            'controller' => 'country',
            'action' => 'city'
        ))
    );
    
    $router->addRoute(
        'province',
        new Zend_Controller_Router_Route(':lang/:country/:province', array(
            'controller' => 'country',
            'action' => 'province'
        ))
    );
    
    $router->addRoute(
        'country',
        new Zend_Controller_Router_Route(':lang/:country', array(
            'controller' => 'country',
            'action' => 'index'
        ))
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a url structure like this. http://example.com/blog/1/title-name-goes-here My main urls
First look at this url: https://stackoverflow.com/questions/tagged/xoxoxo/ This directory does not exists but somehow stackoverflow
I have a URL structure like this http://domain.com/page/thing1 http://domain.com/page/thing2 http://domain.com/page/thing3 I want to: remove
I have an existing journal website with the following url structure http://example.com/dbtable_id/ (eg. http://example.com/89348/)
With the URL Structure like http://www.site.com/user/1 , is it a security risk? For example
I have a web page with basicly the following URL structure: www.example.com/main.php?userId=mattias.wolff www.example.com/definitions.php?userId=mattias.wolff www.example.com/tasks.php?userId=mattias.wolff
I want this url http://www.youtube.com/watch?v=dgNgODPIO0w&feature=rec-HM-fresh+div to be transformed to: http://www.youtube.com/v/dgNgODPIO0w with php.
I want to scrape this URL : https://www.xstreetsl.com/modules.php?searchSubmitImage_x=0&searchSubmitImage_y=0&SearchLocale=0&name=Marketplace&SearchKeyword=business&searchSubmitImage.x=0&searchSubmitImage.y=0&SearchLocale=0&SearchPriceMin=&SearchPriceMax=&SearchRatingMin=&SearchRatingMax=&sort=&dir=asc Go into each of the links
Say I have this url: http://site.example/dir/ In this folder I have these files: test.ascx.cs
H Regarding this URL http://www.codeproject.com/KB/aspnet/FlashUpload.aspx User.Identity as System.Web.Security.FormsIdentity is always null, because the Identity

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.