Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-04-29, 16:03:16

Author Topic: Problem With non www to www rewrite  (Read 3614 times)

0 Members and 1 Guest are viewing this topic.

Offline kuldeep verma

  • Junior Member
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
    • http://www.zodichost.com
Problem With non www to www rewrite
« on: 2013-09-03, 02:10:38 »
Dear Kloxo MR,

I have installed kloxo mr and everything working fine but i unable to set a permanent 301 redirect for non www to www domain..

Here is my config file for the domain:

Code: [Select]
## web for 'example.com'
server {
        listen 80;
        server_name example.com;
        return 301 $scheme://www.example.com$request_uri;
}
server {
    listen xx.xx.xx.xx:80;

    server_name www.example.com;

    index index.php index.html index.shtml index.htm default.htm Default.aspx Default.asp index.pl;

    set $domain 'example.com';

    set $rootdir '/home/admin/example';

    root $rootdir;

    set $user 'admin';

    [.....]

Have tried below code also
Code: [Select]
server {
    server_name  www.domain.com;
    rewrite ^(.*) http://domain.com$1 permanent;
}

server {
    server_name  domain.com;
    #The rest of your configuration goes here#
}

Please help me out i have tried to google a lot and none of the code working :-/
« Last Edit: 1970-01-01, 01:00:00 by Guest »
Cheapest VPS provider With Managed Services
Zodichost.com - A Division of Extreme iTech Pvt. Ltd.

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Problem With non www to www rewrite
« Reply #1 on: 2013-09-03, 03:45:05 »
Did you made 'custom' file for nginx config. Did you knew 'Misc Config' in panel?
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline kuldeep verma

  • Junior Member
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
    • http://www.zodichost.com
Re: Problem With non www to www rewrite
« Reply #2 on: 2013-09-03, 12:11:09 »
no i didnt made any custom file for these configurations. do i need to create one ?

i was putting this code inside /home/nginx/conf/domains/example.com.conf

Many many thanks for hinting that option.. i was not aware of its presence in kloxo cp :p
« Last Edit: 1970-01-01, 01:00:00 by Guest »
Cheapest VPS provider With Managed Services
Zodichost.com - A Division of Extreme iTech Pvt. Ltd.

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Problem With non www to www rewrite
« Reply #3 on: 2013-09-03, 12:34:35 »
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline kuldeep verma

  • Junior Member
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
    • http://www.zodichost.com
Re: Problem With non www to www rewrite
« Reply #4 on: 2013-09-03, 16:54:29 »
Yes i read.. I am facing one more issue..

i created a subdomain of my domain but its not working and showing me the main website instead of showing the content from subdomain directory..

Same thing happening when i am trying to browse webmail.. webmail.example.com also showing me the website home page :-/

What can be the problem ?
« Last Edit: 1970-01-01, 01:00:00 by Guest »
Cheapest VPS provider With Managed Services
Zodichost.com - A Division of Extreme iTech Pvt. Ltd.

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Problem With non www to www rewrite
« Reply #5 on: 2013-09-03, 21:49:30 »
Inform here your 'sh /script/sysinfo'.

Did you set IP to assign to certain client/domain?.
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline kuldeep verma

  • Junior Member
  • *
  • Posts: 29
  • Karma: +0/-0
    • View Profile
    • http://www.zodichost.com
Re: Problem With non www to www rewrite
« Reply #6 on: 2013-09-03, 22:04:38 »
[root@server ~]#/script/sysinfo

A. Kloxo-MR: 6.5.0.f-2013090201

B. OS: CentOS release 5.9 (Final) x86_64

C. Apps:
   1. MySQL: mysql-5.0.95-5.el5_9
   2. PHP: php53u-5.3.27-1.ius.el5
   3. Httpd: --uninstalled--
   4. Lighttpd: --uninstalled--
   5. Nginx: nginx-1.5.4-1.el5
   6. Qmail: qmail-toaster-1.03-1.3.27.mr.el5
      - with: courier-imap-toaster-4.1.2-1.3.14.mr.el5
   7. Dns: bind-9.9.3-5.P2.el5

D. Php-type (for Httpd/proxy):

E. Memory:
                total       used       free     shared    buffers     cached
   Mem:          1024       1001         22          0         85        333
   -/+ buffers/cache:        583        440
   Swap:          511          0        511



Yes i set the ip assigned to one domain and all other subdomains/addon domains are pointing to that domain only. should i revert it ?
« Last Edit: 1970-01-01, 01:00:00 by Guest »
Cheapest VPS provider With Managed Services
Zodichost.com - A Division of Extreme iTech Pvt. Ltd.

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Problem With non www to www rewrite
« Reply #7 on: 2013-09-03, 22:30:56 »
If you only have 1 IP don't assign IP to certain domain. Web server need 1 free IP as share IP.
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

 


Top 10 Social Networking:    Facebook    Twitter    LinkedIn    Pinterest    Google Plus    Tumblr    Instagram    VK    Flickr    Vine
Click Here

Page created in 0.038 seconds with 18 queries.

web stats analysis