I just transferred a website from their previous host to hosting with me. Obviously, I had to change some of the links that pointed to the images to make them display correctly. Unfortunately, it's a huge mess. There were some links described in the mysql database, but i got into MySQL and replaced all of those with the correct link. Originally, it linked to
http://localhost/...
I now need it to link to
http://[subdomain].[website].net/
I've gone through every line of code i could find with fgrep in linux and i can't find where it's inserting localhost. Any ideas where localhost could be stored, if not in the database (as far as i can tell) and not in the physical code? I'm assuming it's a PHP variable somewhere. I'm not sure which, but i already made sure that
<?php echo get_template_directory_uri(); ?>
was set to the correct uri. Any help would be greatly appreciated. thank you.
EDIT
I tried to replace the database information correctly from a clean copy of the database. I used the serialize php script and it didn't work. the images are still not showing up and they're still routing back to
http://localhost
I'm not sure what to do about it. Any more suggestions?
1) Check page source and see exactly where the image URLs point to. Some missing image links may be hardcoded to point to the theme folder or other locations.
2) Did you also move /wp-content/uploads?
3) Dumping the database and doing a find/replace with a text editor will break URLs that are in serialized data. You have to use a tool to correctly deserialize/re-serialize data. See interconnectit.com WordPress Serialized PHP Search Replace Tool
If you're sure that you replaced every occurrence of localhost in the database, then the most likely next culprit is the browser cache, so I recommend you to delete the cache of your browser just to be sure, as this depends on your browser search for the appropriate method, but, for example, on Internet Explorer open the Developer Tools (F12) and go to Cache->Erase cache for this domain.
Related
I recently installed Grocery CRUD to manage my site. The site is written in php and using mariadb to store the content.
I have also activated the CKeditor.
Everything works well and i can write an article and "upload" this to my DB.
In the articles i often want to link to another sites, this should be straight forward, but its not.
When the article is displayed on my website, the URL format is wrong, relative??
Example:
Inputs https://www.test.com
Expect to see https://www.test.com as a clickable link.
This is the result now when looking at the code: https://www.test.com
When hoovering over the link i see https://www.my_domain.com/"https://www.test.com/
I am used to correct this in some situations by adding https://, but this doesnt work in this case.
Im not sure where the error/mistake can be found.
Is it the DB that needs some adjustment, is it the CRUD software and particularly the CKeditor that generates this?
Maybe some PHP issue somewhere?
I need some advice/help on this please.
Does anyone have an idea on how to fix this?
Too many quotes:
https://www.test.com
The pair of \" is an escaped quotes, as if it is inside some other pair of ". The plain pair of " are ok, too. HTML needs either pair, not both. MariaDB does not care, it is just a string.
MariaDB will not cause that to happen. However, the code that does the INSERT may be screwed up. Let's see that code in Grocery.
I have been trying to retrieve the contents of a website (https://www.programsgulf.com/) using file_get_contents. Unfortunately, the resulting output is missing many elements (images, formating, styling, etc...), and just basically looks nothing like the original page I'm trying to retrieve.
This has never happened before with any other URLs I have tried retrieve using this same method, but for some reason, this particular URL (https://www.programsgulf.com/) refuses to work properly.
The code I'm using is:
<?php
$homepage = file_get_contents('https://www.programsgulf.com/');
echo $homepage;
?>
Am I missing anything? All suggestions on how to get this working properly would be greatly appreciated. Thank you all for your time and consideration.
You can't just echo someone's html and expect it to work. Assets (like scripts, images or stylesheets) won't load due to same-origin policy violation unless the server has (mis)configured CORS rules. This is a protection layer in every modern browser that you won't overcome.
If you really want this to work you have to download each asset on the server side, store them locally and replace links in the code to your local copies. This is exactly how web scraping/online proxy software work.
We've moved a php page from one WAMP server to another and the chap who created it has left the business. I know nothing about AJAX, so am struggling!
I've scoured the code on both the old server and new, and it's exactly the same but for some reason the AJAX on the new server isn't working correctly, whereas on the old server it's fine.
What it's supposed to do is show a list of people from our database, allow users to update those records and then show the new, updated record without refreshing the page.
On the old server, it works a treat but on the new server it doesn't load the new data through. It's probably something ridiculously basic, but I'm scratching my head (mainly as I know nothing about the technology!)
Any help much appreciated.
Have you made sure the script that you are requesting with AJAX is actually there? You have said you've uploaded the script but is the path exactly the same? Different environments may have different paths to the same script.
Also how are you making the AJAX request? Are you using (for example) the jQuery library that might exist on one environment but not the other? Are they both using the same version of jQuery?
Use the Javascript console to see what errors you're getting and go from there. Chrome and Firefox have the best ones by default.
https://developer.mozilla.org/en/Error_Console
Before any of this though I would make sure the original script is working and returning the right results.
First check:
Look into the Javascript code and find where the actual URL is constructed.
It will look like:
xmlhttp.open("GET","yourAjaxPage.php",true);
but the xmlhttp can have a different name.
Now, simply alert this URL, or document.write(), or anything that gives you the url.
Put this URL into the browser-url and see the response.
In case you are using a session, make sure you use the same browser (TAB for example) where you expect the result.
Now you will see the response from the server to the request you just made. This should get you going finding the problem.
With the error console we were seeing an error 500 from the server (which seemed odd and rather unspecific...!)
Having had someone we know take a look at the code, it seems that on the old server, it seemed quite happy using mssql_close($con); but on the new server it didn't and so simply replacing it with sqlsrv_close($con) then meant the page the ajax was calling could complete and then returned the results as expected!
Always the little things...!
I am honestly not sure where the issue lays but here is my problem:
I have a single file: card.gif. When I check firebug or Google pagespeed, I learn the file is called twice during the page fetch once as normal file name and a second time with a random number (that does not change). Example:
card.gif
card.gif?1316720450953
I have scoured my actual source code, the image is only called once. It is not called in a CSS file. To be honest I have no idea what is the issue, some thought that when I originally installed mod_pagespeed that it appended ID's to each image in cache for any future overwrites but I can't be certain.
Has anybody ever had this issue before?
In the end - Dagon's comments above led me to believe that things like Firebug and Pagespeed may not always be correct. I do show two images being loaded in the timelines for both plugins but it is very difficult for me to decifer otherwise. If another answer is provided contradicting this, I am more than happy to test that theory.
I have a site complete with CMS etc all working under one domain name. It turns out for legal reasons one page on this site has to sit on a different domain name. The page is hooked into the same CMS as the rest of the site (built using codeigniter). I don't want to have to do another installation just for this page.
Is there any simple way to display just this page under a different domain name without taking it out of the current application?
Thanks a lot
You should look at either (in order):
an include()with correct php.ini configuration
a file_get_content() and printing the variable into your page
an <iframe src="yoururl"> wich would be the easy peasy but unsafe way
using the on-purprose curllibrary
using fopen() wich theorically allows distant files to be opened, but based on my experience, it's not that reliable
Look at this site, it seems rather exhaustive regarding your problem.
Try including the file
<?php include 'http://www.domain.com/url/to/file/page.html' ?>
I think what you need here is a symlink, which is something I don't know too much about. My understanding is that the path displayed to the user does not in fact have to have anything to do with where the file is actually stored, meaning you can set this up to have a completely different URL while keeping it as part of your original application.
A simpler thing is doing a redirect...it's one line of code in your .htaccess file and you're good to go.
include is a possible solution depending on the format of the remote page (ie, this won't work very well if the remote page has a full DOM structure, and you're trying to include the remote page within the DOM structure of your CMS page), however more information about that remote page would be needed to help determine if include() alone would be enough.
Regardless, if include() does, work, you must make sure allow_url_include in php.ini is enabled, as by default script execution will terminate when encoutering a remote URL include statement.