Details
-
Bug
-
Resolution: Fixed
-
Medium
-
4.0.0alpha2
-
None
Description
If an user goes to some url (view) with outdated nice url (name)
like 'http://host/eng/news' but now 'news' is 'News'
so in that case ezp will return the error #4 and will redirect to correct url 'http://host/eng/News'
(all this steps will be invisible for the users) - the user will just see correct URL in his browser
but In non Virtual Host indexDir (eZSys::indexDir()) can contain a question mark '?'
see eZSys:init()
if ( $isCGI and !$force_VirtualHost ) { $index .= '?'; }
but due to error/view.php
$location = eZSys::indexDir() . "/" . $extraErrorParameters['new_location']; ... $location = eZURI::encodeIRI( $location ); // Make sure it is encoded to IRI format
returned uri will be encoded so, question mark will be like %3F
ezp will not understand this url at all
proposed fix:
Index: view.php =================================================================== --- view.php (revision 20716) +++ view.php (working copy) @@ -99,6 +97,11 @@ header( $_SERVER['SERVER_PROTOCOL'] . " 301 Moved Permanently" ); header( "Status: 301 Moved Permanently" ); $location = eZURI::encodeIRI( $location ); // Make sure it is encoded to IRI format + $isCGI = ( substr( php_sapi_name(), 0, 3 ) == 'cgi' ); + if ( $isCGI ) + { + $location = str_replace( '%3F', '?', $location ); + } header( "Location: " . $location ); } }
Steps to reproduce
1. Install ezp in nVH mode
2. Create an object with name 'news'
3. Republished the object with name 'News'
4. Try to view this object by old nice url