Search

I'm really interested in the Rails style routing, this looks like something I can figure out. Unfortunately after dinking around with the extension, I still can't quite get it. A couple details.

  • I've tried it on two sites, one is 2.2.1, and the other is 2.2.3
  • I'm trying it locally on MAMP within a folder, so my URL's look like: http://localhost/SITENAME/PAGENAME/ etc.

I'm trying to just get a simple use case to work first before I worry about getting too many things.

I want to change:
http://localhost/SITENAME/headlines/view/continued-growth/
to
http://localhost/SITENAME/headlines/continued-growth/

My "Rails-type" settings:
From:
headlines/view/:article-name
to
/headlines/:article-name

When I save and try to navigate to the new URL, I still get the output of the headlines page instead of the view page. Am I doing something wrong? Thanks much,

Try it without the minus -. AFAIK, only underscores _ are allowed in those aliases.

I don't really know why though. Maybe it's a bug. :-)

Apart from the minus which shouldn't work, you've got your routes the other way around.

The from param is the new route, which symphony is not aware of, so you need to tell to which page it maps in your current site structure so that it can be resolved.

This is how the regexp routing works too, nothing new, maybe just a little unclear :)

EDIT: looking at the field inline example I understand why you've got them wrong. My mistake, sorry. The from and to examples need to be swapped.

I was able to get this working, thanks to Alpacaaa! I have to say, this is very confusing for the first time user. Here's what I found confusing:

  1. I thought that when I put ":article-name" or "articlename" in these routes, it actually related back to my parameters for the page. Apparently not?
  2. I thought that the new URL still needed to be a page that already existed, when it seems actually to be better to define a page that doesn't actually exist so you don't mess with URL parameters?
  3. As you said Alpacaaa, the "help" text within the documentation itself would lead one to switch the roles of "From" and "To" as I did. Maybe labels like "Old URL" and "New URL" would also be more helpful?
Attachments:
url-router-screen.png

I thought that when I put ":article-name" or "articlename" in these routes, it actually related back to my parameters for the page. Apparently not?

This extension is totally unaware of what your page structure is, so you could use whichever names you prefer.

I thought that the new URL still needed to be a page that already existed, when it seems actually to be better to define a page that doesn't actually exist so you don't mess with URL parameters?

I found this to be a good idea, as it results in a clerer structure. Unless you know what you're doing, of course :)

As you said Alpacaaa, the "help" text within the documentation itself would lead one to switch the roles of "From" and "To" as I did. Maybe labels like "Old URL" and "New URL" would also be more helpful?

This is something that needs to be discussed with @designermonkey and @phoque. I agree the current implementation isn't so clear.

I've got an issue where URL Router adds a trailing / to a route when there's none. (Symphony 2.2.5 and Url Router 1.2)

In my case I redirect /\/abonneer/ to http://foo.bar.list-manage.com/subscribe?u=123abc (note the querystring and lack of trailing slash)

My destination url becomes http://foo.bar.list-manage.com/subscribe?u=123abc/ and fails on the trailing slash ("Too many redirects" error).

The slash seems always added in extension.driver.php:123 which (in my case) is unwanted since there's a querystring.

This is a very useful extension, with amazing support! I've used it several times successfully, but now I'm at a loss and was wondering if you could give me a hand:

I'd like to make a parameter required for the index page, and to avoid 404, www.example.com should become www.example.com/parameter (there will be a default value).

I tried so many expressions but I can't seem to find a way to specifically reference only the www.example.com.

I'd appreciate any advice!

I don't know if this is a similar problem or not.

I am trying to get www.mydomain.com/page/

To redirect to www.mydomain.com/page/parameter

I have tried numerous redirect patterns but I keep on getting too many redirect errors.

Any advice on this problem would also be greatly appreciated!!

I have just solved this problem by having 2 reroute rules:

/page/:parameter to page/:parameter

followed by:

[edit:]

/page/ to page/default-parameter

I selected force reroute if page exists for both rules.

Sorry I completely missed this the first time you posted Dave.

Glad you got it sorted, but if you want to post a screenshot, or list of rewrites, I can maybe try and find a better way? (if one is even really needed?)

When you post the rewrites, if you want to wrap them in backticks, or prefix the line with 4 spaces, it will display better on the forum thread.

Ellie, missed your post too (been a little slack recently)

^$

Would be the `from value to define no value, but it depends on what you need in the parameter box. Does the parameter change dynamically? What would be the default value?

Thank you, John. I missed your post, too.

What I'm trying to do is redirect www.exampl.com to www.example.com/welcome/. In this case welcome is the default value of a required page parameter for the index page and doesn't have to change dynamically (although, I am curious to know if the router can work with dynamic parts).

This redirect should be applied if only the domain is entered, while if the user types in, for example, www.example.com/home/ a 404 will be returned as no entries are found.

I'd appreciate your thoughts!

Hi Ellie,

The URL Router will automatically redirect any parameters from the 'homepage', or Root page, so if you had a root page (with the type of 'index') that accepted parameters, those parameters would be available directly from the root. If a parameter value doesn't exist, and isn't another page's handle, it should throw a 404.

I'd like to make a parameter required for the index page, and to avoid 404

Do you mean that for a user to view the homepage, the parameter must be present? If I'm understanding correctly, then the homepage without a parameter should be auto redirected to the parameter. For a non dynamic redirect, you should be able to use the following (untestedas I have no installs at present, due to a re-install):

from: ^$
to: /your-parameter-name/

I hope this works, if not, give me a shout!

Do you mean that for a user to view the homepage, the parameter must be present?

Yes, that's correct!

I tried from: ^$ to: /default-parameter/, but I get the error No ending delimiter '^' found. If I change it to from: ^$^ to: /default-parameter/, the page redirects, however:

  1. When I access http://localhost:8080/website/ it redirects to http://localhost:8080/default-parameter/, instead of http://localhost:8080/website/default-parameter/.

  2. And if I type in http://localhost:8080/website/parameter-that-should-throw-404/, it redirects to http://localhost:8080/parameter-that-should-throw-404//default-parameter/.

For the first problem, even if it's unlikely, could it be that I'm testing on a local server?

For the second one, I was hoping that it would redirect if only the domain is entered, without any parameters/ other text.

In reality, whatever text is entered is considered a parameter and 404 is thrown only because no entries are found. Maybe the redirect is executed before the data source returns a result...

Or maybe I should insert something else in the to: field, instead of ^$ or ^$^.

Thank you for looking into this.

Ellie, can you explain where website comes into it? Is this the site's document root (http://localhost:8080/website), or is / the document root (http://localhost:8080/)

I'm a little confused.

Document root is http://localhost:8080/website.

Is that also the server's document root, or is Symphony installed in a subdirectory?

It's installed in a subdirectory (website), as I have many.

I see the point, though. I should test it on a real server, but I'm nowhere near production on this...

If its meant to run as a separate website; maybe you can amend your hosts file and set it as a new domain. For development I tend to use sitename.local add a virtual host and modify hosts file to redirect to my local machine (or another ip) and it works like a charm.

Whether you should or shouldn't do it a certain way is entirely up to you. Symphony is built to be able to run in either way, so I really should have mad sure the extension follows suit.

I think I can see what at least part of the problem is.

Ellie, I know it's a pain, but can you log an issue for this, it's definitely the extension that needs fixing. Cheers.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details