Loading

Author Topic: Rewrite rules for location url  (Read 393 times)

Needle

  • Newbie
  • *
  • Posts: 48
Rewrite rules for location url
« on: January 12, 2012, 05:15:23 pm »
I noticed that enabling the permalinks urls are not rewritten the cities, can anyone tell me how to create the rule?


example:

http://www.mysite.com/index.php?page=search&sCity=ALLMYCITIES

TO:

http://www.mysite.com/ALLMYCITIES


thanksssssss  ;D

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 1922
Re: Rewrite rules for location url
« Reply #1 on: January 13, 2012, 10:57:17 am »
Hi Needle,

That's not possible by the moment, since mysite.com/ALLMYCITIES will look for the category ALLMYCITIES,

Anyway, you're free to modify generate_rules.php   Which has all the rules of permalinks, but you will also need to modify hDefines.php to fix the functions that create the new links.


Thanks

mehow

  • Newbie
  • *
  • Posts: 1
    • Email
Re: Rewrite rules for location url
« Reply #2 on: February 18, 2012, 05:08:08 pm »
Hi why not setup a seo urls for location

domain/location/[country/region/city]

any idea how to do this ?


blittcer

  • Newbie
  • *
  • Posts: 35
  • Trabajando en el proyecto www.monoanuncios.es
    • MONOANUNCIOS.es
Re: Rewrite rules for location url
« Reply #3 on: February 19, 2012, 07:47:58 pm »
its a very good idea, we are talking about something much needed, and it should be so.

Search Example:    -- >  Porsche 911 / Vehicles / Cars /  Canary Island / Las Palmas

and it should be appear so:

--> http://www.mysite.com/canary-island/las-palmas/vehicles/cars/   in "search result"
--> http://www.mysite.com/canary-island/las-palmas/vehicles/cars/porsche-911_1   in "item page"

Simple Search Example 2:

 --> Vehicles / Canary Island

--> http://www.mysite.com/canary-island/vehicles/   in "search result"


Trabajando en el proyecto www.monoanuncios.es

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 1922
Re: Rewrite rules for location url
« Reply #4 on: February 20, 2012, 11:40:34 am »
Hi all,


Quote
Example 1:
--> http://www.mysite.com/canary-island/las-palmas/vehicles/cars/   in "search result"

Example 2:
--> http://www.mysite.com/canary-island/vehicles/cars/   in "search result"

How is it possible to make the difference between example 1 and example 2? And I could think of more complicated url's.

Rewrite works with regular expresions, so you only know if the url contains text, numbers, and in which format is.
For me, both urls are you "text", there's no specific format on them, so what rewrite rules will se is

Code: [Select]
http://www.mysite.com/(text 1)/(text 2)/(text 3)

My point is ... in example 1, text 1 is a region, text 2 a city and text 3 a category. In example 2, text 1 is a region BUT text 2 is a category. I could think more urls that will collide
mysite.com/{country}/{region}/{city}/{categories}
mysite.com/{city}/{categories}
mysite.com/{categories}

One solution I could think of, Is to "check" every "text" against a list of know items. for example, check text 1 against the list of countries, and then regions, and then cities, and then .... same for text 2, text 3,.... which is a time and resources eating task.

Other solution is to use akeyword, for example
mysite.com/region,canary-island/city,las-palmas



I'm currently working on that area of OSClass, and I'm open to ideas on how to work this out. I spent a few hours thinking about this already.


Thanks

blittcer

  • Newbie
  • *
  • Posts: 35
  • Trabajando en el proyecto www.monoanuncios.es
    • MONOANUNCIOS.es
Re: Rewrite rules for location url
« Reply #5 on: February 22, 2012, 01:46:19 am »
the best solution in my opinion is:

Now,we only have thse Friendly URLs:

mysite.com/{category}/{subcategory}    searchs with categories
mysite.com/{category}     search with category only.


We need these Friendly URLs:

mysite.com/{region}/{city}/{category}/{subcategory}       searchs with region, city and categories
mysite.com/{region}/{category}/{subcategory}     searchs with region and cateogries
mysite.com/{region}/{city}    searchs with region and city
mysite.com/{region}      searchs with region only.

Trabajando en el proyecto www.monoanuncios.es

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 1922
Re: Rewrite rules for location url
« Reply #6 on: February 22, 2012, 11:34:04 am »
Hi blittcer,

You did not read or understand my last post.

mysite.com/{category}  and  mysite.com/{region} will collide and cause problems

Quote
Rewrite works with regular expresions, so you only know if the url contains text, numbers, and in which format is.
For me, both urls are "text", there's no specific format on them, so what rewrite rules will se is (.+)

So, the rule will be something like

Code: [Select]
^mysite.com/(.+)$    <--- for categories
^mysite.com/(.+)$    <--- for regions

Could you tell them apart? No, because they're the same.

One solution, for example, is to use this URLS

Code: [Select]
^mysite.com/category/(.+)$    <--- for categories
^mysite.com/region/(.+)$    <--- for regions

I'm changing the rewrite customization right now, And I'm really opened to ideas and suggestions. But you need a basic knowledge on how rewrite and regexp works.


Thanks

lordmarin

  • Newbie
  • *
  • Posts: 3
Re: Rewrite rules for location url
« Reply #7 on: April 17, 2012, 08:20:55 pm »
Anyone have solution to rewrite location url?

In my opinion this is the best chiose for search engine optimization...

mysite.com/{region}/{city}/{category}/{subcategory}       searchs with region, city and categories
mysite.com/{region}/{category}/{subcategory}     searchs with region and cateogries
mysite.com/{region}/{city}    searchs with region and city
mysite.com/{region}      searchs with region only.

mysite.com/{region}/{city}/{category}/{subcategory}/ {item} for ads
« Last Edit: April 17, 2012, 08:37:36 pm by lordmarin »

Needle

  • Newbie
  • *
  • Posts: 48
Re: Rewrite rules for location url
« Reply #8 on: April 23, 2012, 11:26:50 am »
upppp  ;D