Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect omits subdirectory #10

Closed
adigitalthing opened this issue Jan 26, 2012 · 2 comments
Closed

Redirect omits subdirectory #10

adigitalthing opened this issue Jan 26, 2012 · 2 comments

Comments

@adigitalthing
Copy link

Local installation, Symphony 2.2.5, URL Router 1.3

Server document root: http://localhost:8080/
Website document root: http://localhost:8080/website

Goal: Redirect from site's index page to the same page with an added required default parameter (data source attached to page filtering entries on required parameter).

Redirect rule: from: ^$^ to: /default-parameter/

Accessing http://localhost:8080/website/ redirects to http://localhost:8080/default-parameter/, instead of http://localhost:8080/website/default-parameter/.

Accessing http://localhost:8080/website/parameter-that-should-throw-404/ redirects to http://localhost:8080/parameter-that-should-throw-404//default-parameter/, instead of throwing an 404 error since no entries are returned by the data source.

@designermonkey
Copy link
Member

First off, I couldn't get my head around the No ending delimiter '^' found that you were getting, until this morning.

I forgot to mention that all of the redirects are Regex as used in the preg functions of PHP, so need delimiting, like so:

/^$/

Above would be the example I mentioned on the forum. Only the from pattern needs this delimiting.

As for the redirecting to DOCUMENT_ROOT rather than the Symphony root, that definitely sounds like an URL Router problem. I'll look into that as soon as I can ;o)

Fixing the delimited regex string should solve the second redirect problem, hopefully.

@adigitalthing
Copy link
Author

Thank you, John!

First I changed the rule from: /^$/ to: /default-parameter/ and it behaved correctly as to whether it should throw a 404.

I thought that delimiting for the to field is required, that's why I used /default-parameter/, but since you mention that only the form needs it, I changed again to from: /^$/ to: default-parameter and everything works perfectly.

I am so grateful, thank you for looking into this and I apologize for my ignorance on the matter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants