You are viewing a plain text version of this content. The canonical link for it is here.
Posted to zeta-issues@incubator.apache.org by "Ronan Guilloux (JIRA)" <ji...@apache.org> on 2010/12/19 10:39:00 UTC
[jira] Updated: (ZETACOMP-35) Trailing slashes in MvcTools URLs
[ https://issues.apache.org/jira/browse/ZETACOMP-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ronan Guilloux updated ZETACOMP-35:
-----------------------------------
Description:
Well, it's more a documentation request than a "real" issue report :
Playing with the HelloMvc sandbox described in the Zeta's MvcTools Tutorial, I noticed that ezcMvcRouter doesn't manage yet the trailing slash at the end of URLs, such as in ~/foo/bar/
If you want to successfully route both ~/foo/bar and ~/foo/bar/, we have two solutions :
* (the short way) customize your apache conf adding
<IfModule mod_rewrite.c>
#Redirecting /Foo/ to /Foo, /Foo/Bar/ to /Foo/Bar, /Foo/Bar/?i=1 to /Foo/Bar?i=1, & avoiding redirect loop on "/" (root view)
RewriteEngine on
RewriteRule ^/$ / [L]
RewriteRule ^(.*)/$ $1 [R=301,L]
</IfModule>
* duplicate your routing rules & conf matchmaps
in router.php :
(...)
public function createRoutes()
{
return array(
new ezcMvcRailsRoute( '/:foo/:bar', 'mkController', 'fooBar ),
new ezcMvcRailsRoute( '/:foo/:bar/', 'mkController', 'fooBar' ),
);
}
(...)
and in lib/config.php
(...)
function createView( ezcMvcRoutingInformation $routeInfo, ezcMvcRequest $request, ezcMvcResult $result )
{
switch ( $routeInfo->matchedRoute )
{
case '/:foo/:bar':
return new mkMuseumView( $request, $result );
case '/:foo/:bar/':
return new mkMuseumView( $request, $result );
}
}
(...)
The first one being the more short & elegant way to me, I propose that it could be added as a tip inside the existing MvcTools tutorial.
And if I'm just misguiding myself, I humbly beg your forgiveness and silently go back to dive myself into php.net & httpd.apache.org/docs ;-)
Ronan
was:
Well, it's more a documentation request than a "real" issue report :
Playing with the HelloMvc sandbox described in the Zeta's MvcTools Tutorial, I noticed that ezcMvcRouter doesn't manage yet the trailing slash at the end of URLs, such as in ~/foo/bar/
If you want to successfully route both ~/foo/bar and ~/foo/bar/, we have two solutions :
* (the more elegant) customize your apache conf adding
<IfModule mod_rewrite.c>
RewriteEngine on
#Redirecting /Foo/ to /Foo, /Foo/Bar/ to /Foo/Bar, & also /Foo/Bar/?i=1 to /Foo/Bar?i=1
RewriteRule ^(.*)/$ $1 [R=301,L]
</IfModule>
* duplicate your routing rules & conf matchmaps
in router.php :
(...)
public function createRoutes()
{
return array(
new ezcMvcRailsRoute( '/:foo/:bar', 'mkController', 'fooBar ),
new ezcMvcRailsRoute( '/:foo/:bar/', 'mkController', 'fooBar' ),
);
}
(...)
and in lib/config.php
(...)
function createView( ezcMvcRoutingInformation $routeInfo, ezcMvcRequest $request, ezcMvcResult $result )
{
switch ( $routeInfo->matchedRoute )
{
case '/:foo/:bar':
return new mkMuseumView( $request, $result );
case '/:foo/:bar/':
return new mkMuseumView( $request, $result );
}
}
(...)
The first one being the more short & elegant way to me, I propose that it could be added as a tip inside the existing MvcTools tutorial.
And if I'm just misguiding myself, I humbly beg your forgiveness and silently go back to dive myself into php.net & httpd.apache.org/docs ;-)
Ronan
> Trailing slashes in MvcTools URLs
> ---------------------------------
>
> Key: ZETACOMP-35
> URL: https://issues.apache.org/jira/browse/ZETACOMP-35
> Project: Zeta Components
> Issue Type: Bug
> Components: MvcTools
> Environment: using Ubuntu 10.10, Apache2, Pear-installed Zeta Component local copy, PHP5, XDebug,
> using Mvc Tutorial found here : http://incubator.apache.org/zetacomponents/documentation/trunk/MvcTools/tutorial.html
> using MvcTools sandbox founded here : https://svn.apache.org/repos/asf/incubator/zetacomponents/docs/examples/applications/HelloMvc
> Reporter: Ronan Guilloux
> Priority: Minor
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> Well, it's more a documentation request than a "real" issue report :
> Playing with the HelloMvc sandbox described in the Zeta's MvcTools Tutorial, I noticed that ezcMvcRouter doesn't manage yet the trailing slash at the end of URLs, such as in ~/foo/bar/
> If you want to successfully route both ~/foo/bar and ~/foo/bar/, we have two solutions :
> * (the short way) customize your apache conf adding
> <IfModule mod_rewrite.c>
> #Redirecting /Foo/ to /Foo, /Foo/Bar/ to /Foo/Bar, /Foo/Bar/?i=1 to /Foo/Bar?i=1, & avoiding redirect loop on "/" (root view)
> RewriteEngine on
> RewriteRule ^/$ / [L]
> RewriteRule ^(.*)/$ $1 [R=301,L]
> </IfModule>
> * duplicate your routing rules & conf matchmaps
> in router.php :
> (...)
> public function createRoutes()
> {
> return array(
> new ezcMvcRailsRoute( '/:foo/:bar', 'mkController', 'fooBar ),
> new ezcMvcRailsRoute( '/:foo/:bar/', 'mkController', 'fooBar' ),
> );
> }
> (...)
> and in lib/config.php
> (...)
> function createView( ezcMvcRoutingInformation $routeInfo, ezcMvcRequest $request, ezcMvcResult $result )
> {
> switch ( $routeInfo->matchedRoute )
> {
> case '/:foo/:bar':
> return new mkMuseumView( $request, $result );
> case '/:foo/:bar/':
> return new mkMuseumView( $request, $result );
> }
> }
> (...)
> The first one being the more short & elegant way to me, I propose that it could be added as a tip inside the existing MvcTools tutorial.
> And if I'm just misguiding myself, I humbly beg your forgiveness and silently go back to dive myself into php.net & httpd.apache.org/docs ;-)
> Ronan
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.