Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+14 votes
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
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).
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
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!
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

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]

Then restart the web server.