This is an old revision of the document!


Page forwarding (redirect)

Example: The page will be redirected to a subdirectory.

Adoption: phpwcms is located in the subdirectory http://example.com/wcms/

Standard entries in the conf.inc.php

// site values
$phpwcms['site']              = 'http://'.$_SERVER['SERVER_NAME'].'/';
 
// paths
$phpwcms['DOC_ROOT']          = $_SERVER['DOCUMENT_ROOT'];
$phpwcms['root']              = 'wcms';         //default: ''


Solution 1:

http://example.com/.htaccess

RewriteEngine on
RewriteRule ^(.*) http://example.com/wcms/ [R,L]


Solution 2:

http://example.com/index.php

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location:wcms/");
exit;
?>


Forwarding with error 404:

If a requested page does not exist, it is often desired that a custom error page is produced with custom layout.
Under normal conditions the given layout of the page “home” was delivered with the error message of the range “error”.

If we write in the “error” area in the template for “home” the following redirect, an error page with a separate layout can be created.
This error page lies typically in a hidden range of the system (ADMIN → site structure → frontend menu status: [x] hide).

http://example.com/index.php?404


Docu: –
Forum: mod_rewrite + RewriteRule + errorDocument

Author: Heiko H.
CMS Version: >= 1.26
Version: V1.0

Tag: –
fileiname: –
Folder: –

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;



[PHP]
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://example.com/index.php?404" );
exit;
[/PHP]


Forwarding with error 404 (second try):

english/technics/tips/page-forwarding.1288550764.txt.gz · Last modified: 2018/06/03 18:08 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0