This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

ASM Forward Media
ASM Forward Media

I want to create a layer of an application (plugin if possible), where you can manage the original URL and the corresponding SEO URL. For example, a client when accessing the "/some/wild/name/page" url, must get "/blog/page/33" page content. But OCTOBER needs to assume that client come to the GET "/blog/page/33" with this plugin. At the same time all generated "/blog/page/33" should be replaced in the resulting document to "/some/ wild/name/page". In addition, when accessing the "/blog/page/33", there must be 301 redirect to "/some/ wild/name/page" (or 404, optional). This is to not globally produce duplicates of the same page. As a bonus, i wish to override some $this[variable] or $this->page[variable] if needed (e.g. for replacing staticBreadcrumbs array).

I'm not very familiar with Laravel nor October. But earlier wrote on Kohana.

Where to begin? So far, except "php_value auto_prepend_file" (apache), "ob_start" and "preg_replace" (php) nothing comes to mind.

Last updated

Crazymodder
ASM Forward Media
ASM Forward Media

This plugin's "schedule" is a really useful feature where needed. But overally, the plugin is NOT that i want. That redirects i can make in .htaccess (quicker response times).

I want URL remapping (reroute internally and rewrite URLs). So that october route logic would be native, and url would SEO urls.

Another example

/seo/makes/coffee  <-> /blog/post/seo-makes-coffee
  1. browser page address: /seo/makes/coffee
  2. octiber routes it like: /blog/post/seo-makes-coffee
  3. accessing "/blog/post/seo-makes-coffe" redirects to "/seo/makes/coffee" (october keeps think is "/blog/post/seo-makes-coffee" route)
  4. globally all "/blog/post/seo-makes-coffee" links replaced to "/seo/makes/coffee" in HTML document

Last updated

Crazymodder
Crazymodder

In october you are free to choose your url structure via slugs. So if you don't like to call it blog you can easy rename slug to seo. Also if you create a post you can rename the slug as you like.

ASM Forward Media
ASM Forward Media

No, i just want to know common practice to remap good structural url into any url. Without overhead, to do it right way.

It is bad decision to make CMS custom pages for 500 categories/products with hierarchy with literally random url in seo mind. It's like make static html pages. The point is to do site right FIRST, and THEN make remapping. Again, remapping NOT follows logic like 'blog' or not 'blog', it can be any url outside

"/i/am/a/bad/url/but/seo/preffers/me" <-> "/catalog/coffee/macco"?

So this approach allows coder to code the right way first, and do SEO tricks after, without much effort. The only good thing here is route remapping like in samples.

So please, give me a point to begin from.

In short, how to do

php_value auto_prepend_file ... (apache)
ob_start ... (php)
preg_replace ... (php)

right in laravel/october?

Last updated

philipptempel
philipptempel

Since October uses a plugin's routes.php if found, why don't you create a plugin that stores these weird routes in a database table and also writes them correctly to the routes.php file? Otherwise, you can design your routes.php file such that it runs a query against the database and parses the results right when it is being called. The latter option though will be way slower than writing the routes.php everytime you create a new of your weird-seo-friendly ;) routes.

ASM Forward Media
ASM Forward Media

Good answer, will try. I started with idea of plugin, but not managed how to do it right. So routes.php is a good start. What about real page url (that "routed" by plugin). Is able to do 301/404 from that if we have a "new route"?

Crazymodder
Crazymodder

Hi,

Status can be set like this:

Redirect::to('/bar', 301);

Last updated

philipptempel
philipptempel

Crazymodder said:

Hi,

Status can be set like this:

Redirect::to('/bar', 301);

That is correct. But if I've understood OP correctly, he does not want to redirect but merely reroute i.e., keep the original URI and just provide content from somewhere else. However, I don't think it would be following HTTP standards if he were to return content i.e., a status code 200, but also returns a status code of 301 or whatever. 301 should be moved if the content has moved. In OP's setup - correct me if I'm wrong - the content has not really moved but can be access through multiple endpoints.

Returning a 404 would be quite simple, see here or here or here.

ASM Forward Media
ASM Forward Media

Basicaly, any unique page must have one and only one unique URL. So, if we have rerouted some content to seo-friendly-url, the old url must return 301 to new, or become 404. Simple.

Last updated

ASM Forward Media
ASM Forward Media

And what about situation, where old url found in page response (content)? This should not be. All "old" urls must be replaced to "new" urls respectively.

Last updated

1-11 of 11

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.