My wordpress theme css files are not working - php

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

Related

Wordpress Images not displaying

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

Wordpress URL change and infinite redirect on permalinks

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.

Copied site to localhost, but URL base is not correct for links or images

I just pulled a copy from a live site and installed locally using XAMPP. The directory is:
127.0.0.1/website-files/websitename
The homepage pulls up just fine, but no images load. The links do not work either. Image and link URLs have not updated to reflect the new directory. They still show as:
/categoryname/pagename
Instead of
/website-files/websitename/categoryname/pagename
The site is wordpress, and the general settings are updated:
Wordpress Address http://127.0.0.1/website-files/websitename
Site Address http://127.0.0.1/website-files/websitename
I added this to functions.php, which I assumed would do all the changes I needed:
update_option('siteurl','http://127.0.0.1/website-files/websitename');
update_option('home','http://127.0.0.1/website-files/websitename');
.htaccess looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /website-files/websitename/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /website-files/websitename/index.php [L]
</IfModule>
I run into an issue every time I move a website to a new dev server, but this one is a first. What am I missing here?
Avoid using a leading / for any links for your website, so instead of:
foo
<img src="/images/bar.jpg">
Do this:
foo
<img src="images/bar.jpg">
And finally, you might want to experiment with adding a "base href" tag to the top of your HTML, which would have a different value depending on what server you're running on. A quick google for base href will teach you how this works.
You might have to restructure how you build webpages to make this happen. That's simply how things are if you want to be able to run a single website on more than one server.
If you're using Wordpress or another similar open source framework, you might be screwed. Some of them are simply incapable of operating on more than one server.
Try to confirm that home and siteurl have been updated in your local database's wp_options table.
Alternately you can can try setting WP_HOME and WP_SITEURL to point to your local files in wp-config.php. This overrides the settings in the options table.
define('WP_HOME', 'http://127.0.0.1/website-files/websitename');
define('WP_SITEURL', 'http://127.0.0.1/website-files/websitename');

Wordpress image['url'] is returning an empty screen after migrating a website

I was working on a Wordpress website in our development server and everything was showing up correctly. I migrated the site to the live server and now NONE of the images are showing up. I have migrated a lot of Wordpress sites, but this time I can't seem to figure out what is going on.
Inside the posts, I have all the feature images set and they are all where they are supposed to be. When I inspect the code in the browser, I see that the loop is returning all the posts but the src, width, and height are empty for each item. The file that handles this template is the same in both locations so I am guessing it could be a database problem?
Here is the link to the development site: www.modpreview.com/mod
And this is the live site m.modworldwide.com
Any idea why this could be happening? Has anyone encountered this problem before? Any help would be appreciated!
Without more info, a guess for you:
Maybe check out the .htaccess in the webroot the site is being served from. Perhaps you are missing the line where the logic says "if the file exists, serve it, otherwise redirect to the php front controller"
which looks like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
This is possible to configure through the wordpress admin if your .htaccess has webserver write permissions, otherwise you need to manually edit it from the CLI or FTP or whatever you are using.
http://codex.wordpress.org/htaccess

Wordpress 403 Forbidden "You don't have permission to access / on this server."

I can't access any pages/login to my WordPress based website.
I get this message:
Forbidden You don't have permission to access / on this server.
after some research on StackOverflow and other WordPress support forums I tried to change the .htacess file without success, also tried to duplicate it from the root directory to /wp-admin again nothing has changed... But I'm not really sure about what I did...
I went back to how it was when it stopped working
permissions are 705 for the folder and 604 for the .htaccess file which is :
SetEnv PHP_VER 5_3
# 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
I'm using WP 3.4 and I don't know if I use PHP 5.3 (what says the .htaccess 1st line) or 4.0.1 (on PHPMyAdmin from the website host access 'OVH')
Thank you very much for your attention.
Ismaël
Make WP recreate the .htaccess the file itself.
Delete .htaccess via FTP, then change your permalink structure to default, then back to your desired permalink style. This will recreate the .htaccess. if that fails, you can try to reinstall the WP core by deleting everything except wp-content and wp-config.php.
Found this when looking for a similar issue I had. Cause & fix was different but may be useful to others...
I have some content external to the WordPress implementation, in a directory called "Documents" (outside the WordPress hierarchy). I then wanted a Wordpress page to list those documents so I called the page "Documents". Accessing that page gave an error. The fix was to rename the directory as "docs" (moving it to wp-content may have worked too).
If you are using WP All-in-One Security plugin, be sure to check the .htaccess file in the root of your Wordpress installation, and look for a section on whitelisted IP addresses. If your current IP is not in the list, then you will get the 403 error.

Categories