Moved wordpress site, image links are all broken - wordpress

Got an issue with a wordpress site that I've never experienced before. I have moved a site for a client from one server to another (I've done this several times before). The site has moved fine, however none of the images from my uploads folder are displaying. When I check the link, there is no "/" before wp-content, so my link reads like this:
http://www.vimartech.co.ukwp-content/uploads/2014/03/VIMARTECH-INDUSTRIAL.jpg
Here is my .htaccess file which is where I believe the issue lies. Can anyone help me out please.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

It's because wordpress holds full path to image in it's database.
This also true for configuration entries.
I haven't used wordpress for some time, but in the past I used a simple search/replace script to change old domain to new at doployment stage.

Related

Changed the URL and ROOT. Main Page won't load. Wordpress

I am trying to redesign a website from a friend and it's chaotic as hell. Now I am stuck a bit.
The old domain it something like http://www.website.com/folder/
I am trying the get rid out of the "folder", so I changed the setting in the wordpress setting and the root in the web-provider. The whole website is working fine, also the Wordpress admin area. But if I'm trying to get into the "home" page, it won't load - or it is loading endlessly.
Do you have any idea how I could fix it?
Regards and thanks,
Natts
A piece often forgotten is the .htaccess file (found in the root of your WP install); I especially suspect it because you're going from a subfolder to no subfolder.
Back it up, then override it with the default WordPress values (or delete it and go to Settings -> Permalinks in WP Admin)
Default .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

wordpress site not starting

I have moved wordpress site to production server from test server. I have done database, code configuration changes. The strange problem i am facing is if i call my website adding index.php then only it shows the site.
http://www.suziesellsaz.com/index.php
If i directly call using domain name it is not working
http://www.suziesellsaz.com
I have thought problem may be because of .htaccess so i have deleted .htacess and saved permalink and it creates following .htaccess but still no luck.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Can some one help me solving the issue?
Please check if under Settings > General settings
Both the urls i.e Wordpress Address and Site Address are same.
Last time I had this issue when they were different. Changing them and reseting permalink fixed this issue for me.
I am not sure about this but, Put your htaccess file back and
RewriteBase /
replace with this
RewriteBase /public_html/
and
RewriteRule . /index.php [L]
replace with this
RewriteRule . /public_html/index.php [L]
May be it's the problem of URL rewriting.
Add the below code in .htaccess file -
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Once done then please make sure that the site URL and home URL for your site are set correctly. You can update the site URL and home URL from wp_options table, WordPress configuration file or from the WordPress administration panel.
Once done then please clear the cache of your system and try to access the website.
Let us know how you go.
Thanks to all of you for your valuable help and inputs. I struggled a lot on this issue and able to find the solution following these steps. Hope it will help some like me.
# Always use domain name in lower case.
In my case client domain is "SuzieSellsAZ.com" treat it as "suziesellsaz.com" all lower case.
Use Database Search and Replace Script in PHP to replace all occurence of previous domain.
ref:
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Update the siteurl and home URL in database options table and all other occurrence in the database.
Once it done or database update then you should import to any server and it will works fine.
Sometime site post or page URL does not work then go to setting > permalinks and save it. Site post and page URL will work fine.

wordpress seeing 404 but the files exist?

So my site is loading VERY slowly so I checked it on gtmetrix.com. The results, below, show that several JS files don't exist.
I have manually checked via FTP, the files ARE there. When I check in my browser directly, wordpress gives me the 404 page.
Is this a .htaccess problem? I really don't get it.
https://gtmetrix.com/reports/gonzalezfurniture.net/t6Exkx0i
edit:
below is the htaccess rule:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Could the problem be that first line after rewriteBase, stopping all other rules?
As it turned out, the child folders inside the plugins folder had various permissions set, which prevented some plugins or specific plugin files from loading.

Wordpress website shows 404 page for folder + images if directly accessed?

Hello guys what can be the reason for this:
I have a folder "wallpapers" not related to my website (Wordpress) in the same web hosting and images inside. If i wanted to access them I would go to website.com/wallpapers/myimage.jpg and it worked!
But I noticed it doesn't work anymore now I see my wordpress site + error 404 inside the website.
I have tried to fix this disabled few plugins etc... but where should I look? What can be the reason? Maybe the htaccess?
Thanks!
Yes, I think your guess on the .htaccess is perfectly correct. If you enable permalinks in Wordpress it automatically creates, or tries to create (depending on permissions) the following .htaccess file;
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The two lines in this that are relevant to you are;
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
What they are basically doing is making sure that every url request gets run through the index.php in the root except any files or directories that actually exist as separate files and directories outwith the Wordpress install (ie your wallpapers directory). So first of all I would make sure that your .htaccess looks like this.
I needed to do the same in the past, and it drove me nuts so if that can help here's what I've done. I had the default .htaccess wordpress created in my wordpress folder when activating the permalinks option, the folloowing :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
for some reason...
I could access http://example.com/phpinfo.php fine,
but http://example.com/myfolder was returning a 404, despite (if I'm correct) the line RewriteCond %{REQUEST_FILENAME} !-d should allow me to show what was into that folder as it's existing and having the correct permissions (user:user chmoded 755)
after having tried everything I could find on the subject, I ended up creating a .htaccess into my folder "/myfolder"
with the unique following line in it :
Options +Indexes
And I finally got http://example.com/myfolder to answer the response 200 OK
I suppose this is not the best ever solution but it's the only one that worked for me and as I just need this to work for one or two folders, it did not need to be more adaptive / flexible

Deploying wordpress to temporary url on live server with subfolder

I have a wordpress site that I was working on locally and on a production server. The site is preparing to launch and I have to show the client that it works on the live server before the domain is transferred over. Unfortunately, the temporary url given to me is http://[ip address]/~foldername, so the site isn't working properly because it is looking in the wrong places. The homepage works fine after I put in the site_url and home_url in the admin, but clicking to interior pages is not.
How can I get it working with this temporary url but also still have it work when the domain switches over. I imagine this can be done with htaccess but not sure exactly what to do.
All I had to do was put in the subfolder in the htaccess file.. so it looked like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~subfolder
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~subfolder/index.php [L]
</IfModule>
# END WordPress

Resources