|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kpripper Smarty n00b
Joined: 21 Feb 2016 Posts: 2
|
Posted: Sun Feb 21, 2016 5:12 pm Post subject: 301 redirect does not working |
|
|
Hello! My site (created with Smarty) have duplicate content:
http://www.alive-inter.net/ukr/proverb-701knonr
http://alive-inter.net/ukr/proverb-701knonr
I try to set up a 301 redirect.
Code: | RewriteCond %{HTTP_HOST} ^www.alive-inter.net [NC]
RewriteRule ^(.*)$ http://alive-inter.net/$1 [R=301,L] |
But it works only on the main page.
How do I solve the problem?
Last edited by kpripper on Sun Feb 21, 2016 5:27 pm; edited 1 time in total |
|
Back to top |
|
kpripper Smarty n00b
Joined: 21 Feb 2016 Posts: 2
|
Posted: Sun Feb 21, 2016 5:21 pm Post subject: |
|
|
Can anybody translate it into Smarty?
Code: | if (preg_match( '|^www\..*|', $_SERVER [ 'HTTP_HOST' ])) {
header ( 'HTTP/1.0 301 Moved Permanently' );
$url = trim ($_SERVER [ 'REQUEST_URI' ], '/');
if(trim($_SERVER [ 'REQUEST_URI' ], '/') != '') $url .= '/';
header('Location: http://alive-inter.net/' . $url);
die();
} |
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Feb 21, 2016 9:10 pm Post subject: |
|
|
Do not translate it to smarty.
Smarty is not a general programming language.
It is a template rendering language.
It knows nothing about HTTP headers, or any other protocol headers whatsoever. |
|
Back to top |
|
|
|
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 vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|