Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

WordPress install on local host

Backend works, front end Page Not Found

         

Broadway

12:04 am on May 12, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I had a local host installation of my WordPress website on my computer using Desktop server that worked fine.
Desktop Server's php version became outdated and when googling, I discovered that that application is now a thing of the past.

I deleted that installation and tried to set up local hosting via both WAMP and then XAMPP.

With both of these installations, when I created a WordPress installation and then imported my existing live WordPress website database to it I end up with the following problem:

Background: Locally, in an example using xampp, I've placed the website in:
C:\xampp\htdocs\example.com.demo

After importing the database from my live website...

1) The backend of WordPress works fine. It uses URLs like:
localhost/example.com.demo/wp-admin/about.php


2) The front end of the website encounters a URL problem that's apparently associated with the "relative" linking I've used in my html anchors (like the form "../website-subdirectory/website-page.html")

The URL shown in the browser ends up being:
localhost/website-subdirectory/website-page.html
The "domain" portion of the URL is not included like it is in the backend of WordPress and this returns a Page Not Found error.

To work, the URL needs to be this form:
localhost/example.com.demo/website-subdirectory/website-page.html
This URL shows the page just fine.

And in fact, once I've typed in the correct URL form into the browser and the web page shows, then all relative linking (../) on that page works fine. The system now has the proper root (domain) info in mind.

What do I need to do to get the front end of WordPress to understand that the "example.com.demo" portion of the URL needs to be included when calling web pages?

not2easy

3:22 am on May 12, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Have you updated the Settings > General Settings page? In the space for the WordPress Address (URL) and the Site Address (URL) it should match the new setup information.

Broadway

3:29 am on May 12, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would still love to hear any ideas anyone has about why my live site functions just fine but the relative linking goes haywire on the xampp and wamp installs.

Anyway, just to get me by and going, I did a database "search and replace" and just hardcoded all links.

not2easy

9:42 pm on May 12, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



and then imported my existing live WordPress website database..
when you imported the database, it contained the settings for where it had been installed. The place to update that is in your WP Admin > Settings > General Settings where WP is obtaining the information for URLs within WP. You can find and replace the URLs in the database, but WP is still using the original settings which now are not relevant.