I'm wondering how I can perform 301 redirect from ‘non-www’ to ‘www’ URLs in Real Estate.
I want all my URLs to be with ‘www’ prefix.
Thanks.
I'm wondering how I can perform 301 redirect from ‘non-www’ to ‘www’ URLs in Real Estate.
I want all my URLs to be with ‘www’ prefix.
Thanks.
Last edited by PGGO; June 29, 2012 at 07:48 PM.
you can use .htaccess file if the script it not doing this allready
---- .htaccess file example ----
RewriteEngine On
#force non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#force non-ssl to ssl
RewriteCond %{SERVER_PORT} !^443$.
RewriteRule (.*) https://www.%{HTTP_HOST}/$1 [R=301,L]
---- .htaccess file end example ----
T.Bogdan
SysAdmin
It does not work for version 4.0.
I'm not even able to access my website with ‘www’ prefix.
then the problem may be elsewhere
first you must check that your host www config is ok ( if you use a vhost then ask your sys admin to check it ). That mean anything you put in your site directory can be accesed by your calling desire hostname. So if your www directory is for examble /home/your-user/public-www and you put there a file called my-file.html then you call that file http://www.your-host.org/my-file.html the response must be positive. If you can call your file only by http://your-host.org/my-file.html and with http://www.your-host.org/my-file.html not then the problem is in the virtualhost config and you ( or your sysadmin ) must config the virtualhost properly
T.Bogdan
SysAdmin
Thanks Bogdan for your suggestion; however, I’m not sure how to perform such changes.
I checked ‘index.php’ file in root directory, and have found the code below.
Does this may cause this issue?
/* www prefix detecting */
$redirect_host = explode('/', RL_URL_HOME);
$redirect_host = 'http://'.$redirect_host[2].'/';
if ( false === strpos($_SERVER['HTTP_HOST'], 'www') && false != strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
elseif ( false !== strpos($_SERVER['HTTP_HOST'], 'www') && false === strpos(RL_URL_HOME, 'www') )
{
$request_url = ltrim($_SERVER['REQUEST_URI'], '/');
header("Location: ". $redirect_host . $request_url);
}
Hello Petnax,
If you want use your site with www and system should redirect you to www you can go to:
ftp:includes>>config.inc.php
find line:
add www. in your site name.Code:Only registered members can view the code.
Viktor,
Flynax technical department,
Best wishes.
Viktor,
Thanks for the info, it works!
In addition, I have notice a ‘302 redirect‘ from non-www to www.
Q: can I add a ‘301 redirect’ instead of 302 ?
It will help for SEO a bit.
Hello Petnax,
Please open file ftp://index.php
find:
in top of file and after it add new:Code:Only registered members can view the code.
I think it should solve itCode:Only registered members can view the code.
Viktor,
Flynax technical department,
Best wishes.
Hi,
Easiest thing is to have domain name with www in the includes/config.inc.php file
Then system will redirect all pages to www.
in addition to this you can put rewrite rule to htaccess file
4.1 software version asks how you want your website to be - with www or without during installationCode:Only registered members can view the code.