Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+14 votes
135 views
in Q2A Core by
edited by

I want to upgrade from version 1.5.4 to the latest version.

Since my current version is too old I'm worried about whether this tutorial will work for this type of upgrade or not. is there anyone who has upgraded from 1.5.4 to the latest version?

I downloaded the source and database to my local to test the upgrade on my localhost and configured it in wamp but when I type localhost in the browser it redirects to my main domain name!

How can I prevent it to redirect to my main domain name and open my q2a site in localhost !?

Q2A version: 1.5.4
by
Have you updated your /etc/hosts file?
by
I use windows and my hosts file contains these two lines:
127.0.0.1 localhost
::1 localhost
by
Try adding a line "127.0.0.1 your-site.example.org" to your hosts file (replace FQDN with your actual domain name). That should make the FQDN resolve to your local host and prevent redirections from going to the live system. Log into the cloned Q2A instance and change settings as needed. Then remove the line from the hosts file.
by
I added this line to my hosts file:
127.0.0.1 mydomainname.com
But when I type mydomainname.com in my browser it says "mydomainname.com refused to connect"
There might be some errors, where should I check server logs in the wamp program?
by
If you type in just the domain name your local webserver needs to be configured to listen on port 80 or you need to redirect http to https either in the browser or the webserver (in which case you'd also need a proper SSL certificate). Check that. Also, while you're using the FQDN your local webserver needs to have a vhost for that FQDN (defining that as a server alias in the localhost vhost is fine). Check that as well. Check if the webserver is listening on ports 80 and/or 443 too.
by
As a side note: please avoid using random made-up domain names that you don't own in examples. RFC 2606 reserves some domains specifically for example and testing purposes. Use those instead (e.g. example.org).
by
apache is configured to listen to port 80
and here is my httpd-vhosts.conf :
# 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>
by
When I type http://localhost/phpmyadmin4.9.7/ it opens phpmyadmin correctly.
But when I type HTTP://localhost it redirects to my online domain name!
And my local copy of q2a is in the root of public_html folder.
I think this problem should be solved in my local copy of q2a not my hosts file or webserver configuration!
by
Like I said, temporarily add your FQDN as a server alias to the vhost config. You need to restart the webserver for that change to become effective.

1 Answer

0 votes
by

Just remove any change you've added to your web server configuration. Most likely this should work for your virtualhost:

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "${INSTALL_DIR}/www"

  <Directory "${INSTALL_DIR}/www/">
        Options -Indexes +FollowSymLinks -SymLinksIfOwnerMatch
        Require all granted
        AllowOverride None
        DirectoryIndex index.php
        <IfModule mod_rewrite.c>
                RewriteEngine On

                RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
                RewriteRule . %1/%2 [R=301,L]

                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
        </IfModule>
  </Directory>
</VirtualHost>

Then restart the web server. 

...