Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

fix redirect when project is installed in subdirectory #530

Merged
merged 1 commit into from
Apr 18, 2013
Merged

fix redirect when project is installed in subdirectory #530

merged 1 commit into from
Apr 18, 2013

Conversation

Tobion
Copy link
Contributor

@Tobion Tobion commented Apr 16, 2013

When neither a vhost with proper document root nor an apache alias is configured, the redirect was to the wrong location (without the path prefix). The context_prefix env variable was not available then, so we need to use the logic to determine the RewriteBase automatically as we have done it to resolve the app.php file too.

BC break: no
fixes: #497 (comment) and following

When neither a vhost with proper document root nor an apache alias is configured, the redirect was to the wrong location (without the path prefix). The context_prefix env variable was not available then, so we need to use the logic to determine the RewriteBase automatically as we have done it to resolve the app.php file too.
@RomainTweaks
Copy link

Hi Tobion. Thank you for your solution.

It works if i pull an Url like this : "localhost:8080/path_of_my_project/app.php/demo/hello/blabla". I'm redirect on "localhost:8080/path_of_my_project/demo/hello/blabla"

But it doesn't work if i test the URL whit just app.php : "loclahost:8080/path_of_my_project/app.php/"
I have an error 404 : No route found for "GET /"...

@Tobion
Copy link
Contributor Author

Tobion commented Apr 17, 2013

So when accessing localhost:8080/path_of_my_project/app.php/ you are not redirected to localhost:8080/path_of_my_project/? It works for me. You sure you don't hit a cache or something?

@RomainTweaks
Copy link

When i use the Url : localhost:8080/path_of_my_project/app.php/ i'm redirect to localhost:8080/path_of_my_project/
but i have a 404 error.
But i think the Url for app.php has a default page. No?

@stof
Copy link
Member

stof commented Apr 17, 2013

@RomainTweaks There is no default page in Symfony.

If you still have the demo bundle, there is indeed a route for / but the demo bundle is not registered in the prod environment

@RomainTweaks
Copy link

Thanks a lot.
This is true i forgot to place a routing in routing.yml for the default controller WelcomeController of Acme.

Thank you!

@FabRondeau
Copy link

Hi everybody and thank you for this discussion.
Many thanks to fredpeaks and Tobion. I've just tested the new .htaccess file and I can confirm that redirecting is OK on my environment (Windows 7, Wamp 2.2, Apache 2.4.2 without vhost).
Good work.

fabpot added a commit that referenced this pull request Apr 18, 2013
This PR was merged into the 2.2 branch.

Discussion
----------

fix redirect when project is installed in subdirectory

When neither a vhost with proper document root nor an apache alias is configured, the redirect was to the wrong location (without the path prefix). The context_prefix env variable was not available then, so we need to use the logic to determine the RewriteBase automatically as we have done it to resolve the app.php file too.

BC break: no
fixes: #497 (comment) and following

Commits
-------

3a4f0e7 fix redirect when project is installed in subdirectory
@fabpot fabpot merged commit 3a4f0e7 into symfony:2.2 Apr 18, 2013
@Tobion Tobion deleted the redirect-subdir branch May 27, 2013 11:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants