For some reason, all of my wordpress images stopped displaying. I've tried disabling all plugins, and reverting to twenty-twelve theme, but still nothing.
When I login to the dashboard and go to the Media Library, this is what I see:
But when I click on one of the images, and go to its path, the image URL will load the image.
It almost seems as if Wordpress has disconnected itself from my uploads folder?
Lastly, on my homepage, when I right-click on the broken image link for my logo (that's not displaying), and choose "Open image in new tab", it doesn't actually return the image URL. It returns:
http://127.0.0.1/
Has anyone else come across this before? I have no idea where to begin solving this, as it doesn't seem to be associated with my theme, or my plugins, and my Wordpress core is up to date.
Any help would be much appreciated. Thanks!
The change the the htaccess file that you mentioned in a comment is likely the cause. This is not part of WP Security plugin. Since you have that security plugin installed, you hopefully made a restore point of your htaccess file and should be able to get a good copy back quickly - it's one of the plugin's features.
Details here: https://www.tipsandtricks-hq.com/how-to-restore-the-htaccess-file-when-using-the-all-in-one-wp-security-plugin-5945
If you need to redo the file via FTP instead, here's a list of the most likely htaccess file content, derpending your site's exact needs: http://codex.wordpress.org/htaccess
Probably, it should look like ths:
# 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
It can be a hack, but this generally happens when your wp_options are not correctly configured.
Quick way to solve: Restore a backup to a previous working condition.
If you don't have a backup or want to check other options, try this:
open phpmyadmin in your live server and access the Wordpress database;
Inside the Database, access the table wp_options;
Check the values for the rows 'siteurl' and 'home'.
EDIT: Method 2 - re-create .htaccess
Rename your .htaccess to htaccess_
Go to Wordpress Settings -> Permalinks
Select the default type and Save, this should create a new .htaccess
Open the homepage of website and check if it changed something
Return to Permalink Options and select the way you had it before
Related
I've been having some issues with my wordpress theme, i recently created a new theme and tried using it in my wordpress site, but i discovered that the css isn't loading. The css loads properly in my localhost and i didn't make any changes before uploading to the server,but after i uploaded it to the server, my css stopped working. I've never experienced this before and I'm 100% sure my header.php and functions.php file are correct. I checked with chrome dev tools to see if my css is loading, and it loads correctly.
I can see my css files showing in the head section in chrome dev tools, but my website page isn't displaying with the styles. Please what do I do? Also, i used wordpress 5.4.2 in my online server, but i used wordpress 5.3.4 in my local machine, does this affect anything
Looking at your website, your css files are all 404s. So the issue appears to be your server and not in WordPress. Please ssh/ftp/etc into your server and verify the files exist and have the correct permissions and ownership. In other words, could be a number of things wrong with your server, but the first things to look at are:
Do the files exist on the server in the correct location?
Do the files have 644 permissions?
Do the files have the correct owner? (I.e. if you uploaded as root, root owner should be the owner of the new files. Works fine if the files already existed, uploading as root (typically) won't change this, but if they're new they'll default to the logged in user).
Check your .htaccess, remove folders and just have index.php inside of it.
By folders I mean if it says eg. /new/index.php, just leave /index.php, and also check rewrite base.
You should have something like this
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
You should also check your urls in wp_options in database.
If it says http://localhost/your-project/ then you need to replace it with your current url of the project that is remote.
I think you need to flash your permalink. Just go to setting>permalinks and hit save button. I hope your css file will work fine after flush your permalink.
Thanks
I am fixing an old wordpress site that is not to be updated but maintain the same state. It was created in 2012. Over the years the hosting company updated PHP and Wordpress automatically and broke the site.
I need the site to be in it's 2012 state so that everything works well. I have rolled the Wordpress version back to 3.3.1 and have PHP 5.4 running on the site.
Certain functionalities work again on the site which is good. However, the admin panel doesn't work in so much as the admin menu appears but when you click on the tab it is blank on the right hand side. If you know how to fix that, please let me know. Error logging doesn't appear to produce any leads.
My issue is that in rolling back, permalinks have gone back to their ID routing rather than page name routing. I need them to be page name routing but since the admin menu is broken I will have to create some rewrite rule in functions.php to achieve this.
Can someone inform me what to write on this. I am unfamiliar with rewrite rules.
This should go without saying, but make sure you have a backup before trying this!
I have not tried this myself, and I'm not sure how much has changed since 3.3.1, but this is what I would do:
Locate the permalink_structure entry under the option_name column of the wp_options table.
Modify the option_value to the structure you want to use. For example /%postname%/
To flush the permalinks or rewrite rules from your theme, you need to use the flush_rewrite_rules() function. Add the function to your functions.php file and refresh a page, then comment it out - you only need run it once.
Confirm the .htaccess rewrite rules are in place:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
And hopefully, that should be it!
I have a strange problem with wordpress: every time I try to write / update / preview a post with the code below, it redirects me to the home page.
Here is the code:
$segments = \Uri::segments();
if (empty($segments))
$segments[0] = 'homepage';
Other useful information:
I have last Wordpress version
I've tried cleaning the cache
I've tried with a fresh install
I've tried without any plugin nor any custom theme
All other post works well, even the one with other source code
The error log is empty
Hope you can help because I don't know what else to do.
UPDATE 1
This is my .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
UPDATE 2
As I said before, I'm redirected to the home page if I insert that 3 line in the post and then if I try to insert / update / preview a post. BUT, if I copy past on the toolbar the preview link, it works (don't know if it can help)...
UPDATE 3: RESOLVED
Finally found the problem: it was a Mod_Security rule in the server that redirects to the home page in case it happens. Finally it works again :).
Thank again for helping
This might not be the answer you expected, but your code and you .htaccess file look fine and I don't think that this is a "redirect problem".
When you said:
I've removed every template and plugin (deactivating them and deleting the folders) to be sure was not relate to one of them, but the problem was still there.
It sounds like there might be a problem with your server (possibly even wordpress itself).
I think you should report this problem to wordpress, maybe even file it as possible bug.
Good luck and all the best.
Are you able to access to your virtual host file? Maybe a rule on the configuration file is doing the redirect. Also, check your permalink settings, try changing the permalink structure and then see if the preview works.
Additionally, could you add your functions.php theme file so we can take a look at it? Perhaps a custom function is causing this behavior.
If you have previously had a non updated plugin such as rev-slider you may find that your security has been breached and something was modified to prevent you from doing an update. If this is the case there are some things you can do but look at the .htaccess for redirects and also if necessary compare the main files against the release version you have running for little differences. Assume you have tried disabling all plugins and switching back to default theme etc?
You say that you have explored all of these .. I would then be looking to do command line tests using curl or similar to view the headers to see what is going on.
In the options you could try changing to url formatting options (permalink) for posts and pages through WP console - this can help flush through changes caused by templates etc. You can change them back .. there are a couple of places by memory that you can do this but it's been a while so can't give more explicit links.
Your symptoms at a quick glance smell like a permalink setting that has hung around and needs updating.
I recently changed my wordpress blog's server and URL. Before, it was located at subdomain.website.com and now it is located at website.com/newurl. I copied over the files and database, and updated the site URL and and website URL successfully. Initially, the site seemed to have been functioning properly. Somewhere along the road, the server started feeding back an infinite redirect loop on blog posts only. I can properly view the blog's homepage, but when I try to access specific blog posts it enters into an infinite redirect loop. If I turn of permalinks, and use the raw url i.e. website.com/newurl/?p=232 it serves the page properly.
Any idea why my permalinks no longer work? I already tried turning off plugins, and it still doesn't work. I also tried resetting the htaccess file with no success. Any advice is much appreciated.
Here is my htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
Also, I am not sure it is relevant or not, but the wordpress installation is in a subdirectory of a magento installation.
A few things to check...
Have you updated the table wp_options? - There are two fields in there that need to be updated when migrating a website, the option names are siteurl and home.
Also depending on your server settings, you may have to manually update your .htaccess as updating your permalinks doesnt always update your htaccess, a problem Iv run into before.
One last idea, the ‘AllowOverride FileInfo’ directive may be the problem, the .htaccess needs to override the main httpd.conf configuration file and is unable to do so without this directive. (This fixed a problem I had a while ago when the postname permalinks ect were not working but using the actual URL was)
Goto Settings -> Permalink -> Select (Post name) and Save it. No matter it is already selected just do it once again. Goto your site and Refresh page and check urls again. This is a common issue occurs when you migrate in other ways.
Please don't touch your htaccess file.
I have experienced this kind of stuffs in the past and only shows right after you moved wordpress to either another folder, a new domain, or when you change hosting.
To fix it, please correct your Wordpress Address and Site Address... I usually just addd/remove WWW and/or changes HTTPS to HTTP and vice versa
In the end the problem was a plugin titled "WP No Category Base" that was causing the redirect loop. Once I disabled it my website was functioning properly again.
Next time you want to move a WordPress site, you can consider using a WordPress plugin to handle the job for you.
There is several plugins that can do this for you.
Check this one : Golive
GoLive Features:
Automatically Export the Database from Source Server
Transfering the files via FTP automatically
Auto-import Database in Remote/destination server.
Update .Htaccess properly
Update wp-config.php file on destination server with the new credentials.
Replace the URLs in Database (Posts, Pages, Menus…), and keep auto-update serialized objects too.
I'm migrating my first Wordpress site to a live server. Eventually the site will have it's own domain name, but for testing purposes I have uploaded it as a folder within my own personal site.
http://connorhome.com/moorfield/
All the pages work except the 'restaurant' page, which throws up a 403 error. The page is fine locally. It is worth noting that this page uses a different template to the other pages.
If I change the permalink structure to 'default', the page loads fine. Does anyone have any ideas of how to fix this? I have read that 'post name' isn't a great way of structure permalinks, but for the sake of this site (which only has a few pages) it is ideal, so I'd like to get it working if possible. Thanks.
This is what my .htaccess file is showing:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /moorfield/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /moorfield/index.php [L]
</IfModule>
# END WordPress
you must have a conflict with the slug 'restaurant', check if you have a post or custom post type item that has the same slug.. also, try to resave the permalinks so as to flush the rewrite rules.. i usually have these problems when i have a custom post type rewritten with the same slug as an existing page
Sorry that I cant comment yet since I would have done instead of answering. But I am wondering if 'Restaurant' is a custom taxonomy.
Also, check your trashed pages and posts to see if any pages are there with the same permalink as /restaurant - and if so delete them.
Instead of using the rewrite rule, create an actual subdomain via your hosts admin tools. Then, regenerate the .htaccess file. So it will be: moorfield.connorhome.com
Try flushing your Rewrite Rules with this plugin
make sure rewrite mode enable in your server first check in your server rewrite mode is enabled or not because this errors come only when the rewrite mode not enabled.
and in localhost you can enable and apache2 extension rewrite then check it is working on not.
Maybe you should reset the permission of your 'restaurant' directory. More detailed info here: http://en.wikipedia.org/wiki/HTTP_403