Pages: 12Next
Current Page: 1 of 2
localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 15, 2018 12:49PM

Hello, so firstly:
Wamp Version 3.1.0 - 64bit
Apache version 2.4.27

So my problem is, I copied a live joomla website, all the files with FTP to my PC and then uploaded them to the localhost site directory.. wamp/www/site.... and also exported/imported the database.

But now when I go to my localhost, select my website under virtual hosts, it redirects me to "www.mysite/ instead of mysite/ how it should be, so therefore I cannot access the site. I can access the backend normally and there is no www infront.. mysite/administrator

Over on the joomla forum they told me they cant help me because this is most likely not a joomla problem.

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 15, 2018 12:58PM

Hi

Show us your httpd-vhosts.conf file and also check that you put the new domain name in the HOSTS file. Maybe show us the HOSTS file as well.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 15, 2018 01:14PM

Hello, I don't know if it's possible to attach files or pictures, so I will just copy it here I hope that is fine..

HOSTS: (not sure if you need the whole file or just this part)

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

127.0.0.1 localhost
127.0.0.1 joomla


VHOSTS:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "c:/wamp64/www/"
ServerName localhost
ServerAlias localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/wamp64/www/joomla/"
ServerName joomla
ServerAlias joomla
</VirtualHost>

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 15, 2018 01:28PM

Hi

Why have you changed the contents of the httpd-vhosts.conf file? That is not what was delivered by WAMPServer?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 15, 2018 01:33PM

Hello,

I was following some tutorial about some problems I had and it said to empty the vhosts file and write the info this way. I'm guessing that was not a good idea.. :s

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: Otomatic (Moderator)
Date: May 15, 2018 02:05PM

Hi,

Why do you follow tutorials, written by people who don't know much about it and who date, when everything you need is here.

Your hosts file MUST be:
127.0.0.1 localhost
::1 localhost

127.0.0.1 joomla
::1 joomla

and your httpd-vhosts.conf file MUST be :
# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>
#
<VirtualHost *:80>
   ServerName joomla
   DocumentRoot "c:/wamp64/www/joomla"
  <Directory "c:/wamp64/www/joomla/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride all
    Require local
  </Directory>
</VirtualHost>
#

In addition, all the tools needed to manage VirtualHost are integrated in Wampserver.

- If it is not already done, apply Update 3.1.3 to your version of Wampserver
Wampserver update 3.1.3

Do not forget, after modifying the hosts and httpd-vhosts.conf files, to restart the DNS so that the changes are taken into account by the system and by Apache.
Right-click -> Tools -> DNS Restart

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 15, 2018 02:18PM

Hello,

sorry, and thank you for providing me the correct structure of the files. I changed the hosts and vhosts file, updated Wampserver and restarted DNS and the site still opens as www.joomla.

PHP version im using is 5.6.31
MySql 5.7.19
MariaDB 10.2.8

If this info will mean anything

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 15, 2018 02:23PM

When you say the site opens as www.joomla what are you doing to get that result?

Are you clicking on the wampserver homepage?
Are you entering something directly into the browser address bar?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 15, 2018 02:25PM

Hello,

When i'm on the wampserver homepage, If I click under Projects or Virtual Hosts, both opens as www.joomla.
Same thing happens if I type it directly into the browser

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 15, 2018 02:36PM

First did you type `joomla` or `www.joomla` into the browser address bar?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 15, 2018 02:43PM

I type in "joomla" and when I press enter it automatically changes to www.joomla.. it does this in chrome and firefox.. When I type "joomla" in microsoft edge it doesn't add www. but it says page unavailable.. If that means anything

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 15, 2018 04:41PM

Can you open a command windows and do

> ping joomla

And show the result.

Possibly you may need a reboot to make the DNSCache refresh

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 16, 2018 07:34AM

Hello, sorry for the late reply I was out of the office.

these are the results:

Pinging joomla [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 16, 2018 11:12AM

And after that it still gives you the same issues?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 16, 2018 11:50AM

Yes.

I made a new virtual host with a fresh cms version without copying the content and its working normally.. my guess is there are probably some settings somewhere that are forcing this rewrite or however shoud I call it.. perhaps in the .htaccess file? No clue

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 16, 2018 11:51AM

Thats a very good point, that may well be your issue.

Check the Joomla config file

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 16, 2018 12:06PM

Everything seems in order in configuration.php, only the database and logs path and things like that needed so that can't be it.. Hmmm..

These settings are in the .htaccess, is there anything wrong in here perhaps?

Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: RiggsFolly (Moderator)
Date: May 16, 2018 12:22PM

Sorry, no Joomla experts here

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 16, 2018 12:58PM

Okay, well thank you for your help still

Options: ReplyQuote
Re: localhost website forces www. in the url
Posted by: zaaanck (---.ika.si)
Date: May 17, 2018 02:46PM

Hello, just posting here to tell if anyone else faces this problem: in Joomla there is a component called Artio JoomSEF which was causing this, to fix it go to JoomSEF global configuration and set www and non-www domain handling to non-www.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, you can't reply to this topic. It has been closed.