• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Redirect script beïnvloed admin
PostPosted: Fri Feb 08, 2019 7:38 pm 
Offline
Power Poster
Power Poster

Joined: Sun Apr 19, 2009 9:33 am
Posts: 1298
Rolf wrote:
Waar ik met het script wel tegen aanloop is bijzondere tekens in de URLs. Dat gaat niet altijd goed...


Wat bedoel je met bijzondere tekens? Unicodes zoals die in verschillende vreemde talen kunnen voorkomen, zoals accenten: "Lörick" ?

Of URL-encodes strings [urlencode()] ?

Rolf wrote:
Toevallig heb ik net in de mail een soortgelijk script gekregen van een andere CMSMS gebruiker. Dit weekend ook eens testen!


Succes met testen, houd je apache access logs maar open als je de [preview]-tab bekijkt.

_________________
The CMSMS Builder is a tool to help you develop and optimize CMS Made Simple >= 2.2.3 themes, it is made by a developer for developers.

I you like an automated file based work-flow this project might be for you. It is usable to kick-start a new CMSMS project or it can be applied to existing ones.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Redirect script beïnvloed admin
PostPosted: Sat Feb 09, 2019 11:08 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7617
Location: The Netherlands
Dit werkt voor mij op https://pneumatic.tube, zowel in de frontend als de backend!
Code:
$canonical_url = isset($params['canonical_url']) ? $params['canonical_url'] : '';

if ( $canonical_url != '' )
{
  if ( strpos( $_SERVER['REQUEST_URI'], '_preview_' ) !== false ) return;

  $browser_url = htmlspecialchars ( ( isset($_SERVER['HTTPS']) ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
  $canonical_url = str_replace(' ', '%20', $canonical_url);

  if ( $browser_url != $canonical_url )
  {
    header('Location: ' . $canonical_url , true, 301);
    exit;
  }
}

Getest met o.a.:
https://pneumatic.tube/index.php
https://pneumatic.tube/&tag=berlin
https://pneumatic.tube/&tag=german%20language
https://pneumatic.tube/foo/bar/suppliers

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return!



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Redirect script beïnvloed admin
PostPosted: Sat Feb 09, 2019 2:28 pm 
Offline
Power Poster
Power Poster

Joined: Sun Apr 19, 2009 9:33 am
Posts: 1298
Je hebt nog een probleem met letters die buiten de tekenreeks [a-z], zoals de duitse S, vallen:
Code:
https://pneumatic.tube/&tag=großrohrpost


In sommige gevallen kan een dergelijk teken, bijvoorbeeld "ö" uitmonden in een "infinite" redirect:
Code:
https://pneumatic.tube/calendar/the-mix-genest-company-was-founded-by-the-businessman-wilhelm-mix-and-the-engineer-werner-genest-in-berlin-genest-in-berlin-schöneberg


Buiten "spaties (%20)", zou je ook andere tekens kunnen vervangen. [& (%26), ^ (%5E), # (%23), $ (%24), % (%25) en vele andere....]

urlencode/urldecode ipv:
Code:
$canonical_url = str_replace(' ', '%20', $canonical_url);

_________________
The CMSMS Builder is a tool to help you develop and optimize CMS Made Simple >= 2.2.3 themes, it is made by a developer for developers.

I you like an automated file based work-flow this project might be for you. It is usable to kick-start a new CMSMS project or it can be applied to existing ones.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Redirect script beïnvloed admin
PostPosted: Sun Feb 10, 2019 1:24 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7617
Location: The Netherlands
Ja, ik weet het!
Uiteindelijk bleek het probleem in mijn tags methode te zitten...
Heb de UDT nog wat aangepast en alles werkt nu!
Zal er een blogje van maken.

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return!



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Redirect script beïnvloed admin
PostPosted: Sun Feb 10, 2019 3:01 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7617
Location: The Netherlands
https://cmscanbesimple.org/blog/redirec ... onical-url

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return!



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Redirect script beïnvloed admin
PostPosted: Sun Feb 10, 2019 5:07 pm 
Offline
Power Poster
Power Poster

Joined: Sun Apr 19, 2009 9:33 am
Posts: 1298
Goede blog Rolf mooie aanvulling op je verhaal over het zetten van canonical url's en redirects via .htaccess.

Ik heb nog een variant bedacht als je te maken hebt met pure content pagina's zonder modules als News/CGBlog/Calendar oid.


Deze werkt op basis van de page_alias en cmsms_selflink ook toe te passen in een UDT:

Code:
$tmpl = '{$page_alias}';
$page_alias = $smarty->fetch('string:'.$tmpl);

$tmpl = '{cms_selflink page="'. $page_alias. '" urlonly="1"}';
$selflink = $smarty->fetch('string:'.$tmpl);

$browser_url =  urldecode ( ( isset($_SERVER['HTTPS']) ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );

print "<pre>\n";
print "browser_url:$browser_url \n";
print "selflink:$selflink \n";
print "</pre>\n";

_________________
The CMSMS Builder is a tool to help you develop and optimize CMS Made Simple >= 2.2.3 themes, it is made by a developer for developers.

I you like an automated file based work-flow this project might be for you. It is usable to kick-start a new CMSMS project or it can be applied to existing ones.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting