Search

Hi, please how can I redirect to the web root directly? E.g. from example.com/page/ to just example.com

I was getting only to example.com// or alike. I am not a boss with regexp as you can see :)

My index page is /home/, but I don't use it in URL structure. Do I have to jump there and have a .htaccess rules on that?

I have frontend_localisation and flang_detection_gtlds installed for multilanguage support. Does it matters in some way?

Thanks for any ideas.

Juro, frontend_localisation should not matter here.

The index page should work with or without /home/ as for the redirect I am not sure as I think that the extension by itself adds a / before and after. I have not used the latest extension yet but that probably is the case. Not sure if someone else could confirm this.

The .htaccess would work for sure if you want a quick solution.

@gunglien I don't believe the issue with Querystrings has been addressed (@designermonkey?)

My client has made a work-around by adding a intermediary page so I have not run into it again (and have forgotten about it).

Strangely though when I just checked there was another redirect with a querystring, pointing to a google form, that worked. Maybe this indicates that it is indeed an issue with the remote server config: maybe google accepts/strips the trailing "/" and the other service did not?

I don't think this is the issue @Animaux is having but anyway, I think this should be handled: there should not be a trailing slash added to a querystring.

@Gunglien, yes, I planned to do it with .htaccess, but I saw this extension updated for 2.3, and it looked handy, which I think it is.

Actually, my first to setup was /, but then there were 3 forward slashes.

The rails syntax wouldn't help it, would it. But I don't understand it though. Is it ruby on rails syntax?

Anyway, thanks very much for your information.

@davidhund ok no worries will work on a custom extension see if that does the trick. If I manage to pull it off and works as expected will try to update the extension and submit a patch. I'm not sure if its too early/late for query strings to be updated in the url. Will have a shot.

@juro it's not the syntax that's the problem I think the script does a trim and adds / at the beginning and the end of the string so you were always going to have extras. Maybe @designermonkey can have a quick look at this.

@davidhund @designer monkey - found a way to handle url-parameters.

Would you prefer if these appeared in symphony with the url- or without? so variable or url-variable

If they're to be used inside Symphony, then the standard approach should be followed using url- at the beginning.

@gunglien. Cool. And what @designermonkey said: with url- at the beginning.

Ok just wanted to be sure - as they would otherwise look like page-params. Will try to install the url-router on a 2.3 over the weekend and start applying the updates. I will try to not-break anything in the process - hopefully will manage.

I'm trying to run url router on a 2.3 install and I keep getting the same error no matter wether I try to route or redirect. Any thoughts? Thanks!

Symphony Warning: file_put_contents

Update

Ok please disregard! I had the from/to fields reversed. The only reason I figured this out was because of the open issue on github. The instructions really should be clarified.

The instructions really should be clarified.

The instructions are correct in actual fact. If you'd like to offer an example of what you think they should be though, I'm happy to listen.

From is the URL the user has in their browser, which redirects To the new URL. It seems pretty straightforward and logical to me. It's always been this way round and has never changed since the first version of this field.

The instructions really should be clarified.

I slightly have to agree with this. Once you've used it and know it it's clear, but I also had to read & try it a couple of times the first time before I understood it. For example:

  • I didn't know you could choose for simple OR a regexp, I thought simple was an example URL. Once I'd tried a couple of regexp's first, I figured out that simple was just another way to write your route.

Perhaps a simple example would clear a lot:


To change http://www.example.com/projectspage/detail/pictures/{@id}/ to http://www.example.com/projectspage/detail/{@id}/pictures/ you can either do:

Simple:

From: projectspage/detail/pictures/:id
To: projectspage/detail/:id/pictures

Regexp:

From: ...
To: ... (I'm not so good at regexp)


This could also be in a little hover / popup balloon when you hover over the short description.

Good extension though!

There's also a small thing - on new / edit the example code changes. The edit one is correct.

I am trying to achieve to route the following url…

/articles/2012-12-21/this-is-the-article-title

to…

/article/2012/12/21/this-is-the-article-title

Here's what my URL Router setup looks like…

image

FROM:

/\/articles\/([0-9]*)-([0-9]*)-([0-9]*)\/(.*)/

TO:

/article/$1/$2/$3/$4/

This doesn't seem to work though. Am I doing it wrong?

Does the articles page exist? If it doesn't: try recreating this exact setup with a redirect, that will make it a bit more clear where the error is (the page should not exist if you don't check the checkbox). The regex seems to be OK.

Have a try with

From: /\/articles\/(\d{4})-(\d{2})-(\d{2})\/(.*)\//
To: /article/$1/$2/$3/$4/

This way you're specifying exact digits to look for.

@creativedutchmen - the articles page does exist.

@designermonkey - made your changes and just get a 404.

I just tested the regex I provided away from Symphony, and it's a valid preg regex string. Weird why it doesn't work here...

I'll have a look...

PS, what does the ?debug view show?

Could it be that @designermonkey's regex has \// at the end, when the given URL omits trailing slashes?

/me runs away from regex land

when the given URL omits trailing slashes?

I guess this isn't possible, because the rules from .htaccess add the trailing slash.

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