Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
in Q2A Core by
edited by
I have a q2a website running in production, I made a backup from PHP files and MySQL and restored it on my local machine. (I use a wamp server)

Now when I type localhost in my browser the website redirects to my main domain name and opens the running q2a website.

How can I prevent redirecting from localhost to the main domain?
I changed the site_url to localhost in qa_options table and deleted .htaccess file but the same problem happened!
Q2A version: 1.5.4

1 Answer

0 votes
You should change the main domain in The Admin panel

General > Preferred site URL
So I will give you the steps I did:
1- Take a backup copy of your website files and save them on your device.
2- Take a backup copy of the database from the Cpanel, not from Phpmyadmin, where you go to Backup, choose the database and download it to your computer.
3- Put the site files in htdocs file and then log in to phpmyadmin of localhost and import the database.
4- Edit the config.php file and then open your site through the browser, it should work now without the need to fix any of the tables.
5- If the site works correctly, enter the admin control panel and modify the site link in the general, and if software errors appear, enter the plug-ins folder and delete all plugins temporarily until you are sure of the source of the error, because often the plugins do not work correctly on the local server.
Note: The link to the site is completely, for example: http://localhost/ask
Again it is redirecting from localhost to the production site! :(
You can contact me so that I can log into your device through the any desk program and try to find a solution to the problem
That would be great and we will share the solution here. :)
When do you have time?
I will send you a private message.