MiAmir
February 2nd, 2018, 02:15
سلام ، دوستان وقت بخیر!
اخیرا با مشکل خطای 404 مواجه شدم به صورتی که Front page موردی نداره ولی پیج های دیگه با خطای 404(not found) مواجه میشن.
و مثل اینکه تو این بخش از بدنه کد هام ایراداتی وجود داره ممنون میشم از دوستان متخصص اگه کمکم کنن...
// Only redirect no-www <=> yes-www
if ( strtolower($original['host']) == strtolower($redirect['host']) ||
( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) )
$redirect['host'] = $original['host'];
$compare_original = array( $original['host'], $original['path'] );
if ( !empty( $original['port'] ) )
$compare_original[] = $original['port'];
if ( !empty( $original['query'] ) )
$compare_original[] = $original['query'];
$compare_redirect = array( $redirect['host'], $redirect['path'] );
if ( !empty( $redirect['port'] ) )
$compare_redirect[] = $redirect['port'];
if ( !empty( $redirect['query'] ) )
$compare_redirect[] = $redirect['query'];
if ( $compare_original !== $compare_redirect ) {
$redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
if ( !empty($redirect['port']) )
$redirect_url .= ':' . $redirect['port'];
$redirect_url .= $redirect['path'];
if ( !empty($redirect['query']) )
$redirect_url .= '?' . $redirect['query'];
}
اخیرا با مشکل خطای 404 مواجه شدم به صورتی که Front page موردی نداره ولی پیج های دیگه با خطای 404(not found) مواجه میشن.
و مثل اینکه تو این بخش از بدنه کد هام ایراداتی وجود داره ممنون میشم از دوستان متخصص اگه کمکم کنن...
// Only redirect no-www <=> yes-www
if ( strtolower($original['host']) == strtolower($redirect['host']) ||
( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) )
$redirect['host'] = $original['host'];
$compare_original = array( $original['host'], $original['path'] );
if ( !empty( $original['port'] ) )
$compare_original[] = $original['port'];
if ( !empty( $original['query'] ) )
$compare_original[] = $original['query'];
$compare_redirect = array( $redirect['host'], $redirect['path'] );
if ( !empty( $redirect['port'] ) )
$compare_redirect[] = $redirect['port'];
if ( !empty( $redirect['query'] ) )
$compare_redirect[] = $redirect['query'];
if ( $compare_original !== $compare_redirect ) {
$redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
if ( !empty($redirect['port']) )
$redirect_url .= ':' . $redirect['port'];
$redirect_url .= $redirect['path'];
if ( !empty($redirect['query']) )
$redirect_url .= '?' . $redirect['query'];
}