How to Fix WordPress Maintenance Mode

“Briefly Unavailable for Scheduled Maintenance. Check back in a minute.”

This error warning got highlighted on all blog pages and WordPress admin as the site became inaccessible when we are doing Automatic Upgrade. There was no way to get access to the site or WordPress Admin.

When WordPress autoupgrades, it inserts a .maintenance file in the WordPress root directory, which displays the message, so people don’t see the broken php codes as the site continues to upgrade. Once the WordPress core and database is upgraded, the .maintenance file is deleted and the site comes back online normally. In some cases, the process gets stuck, and the .maintenence file fails to get deleted.

FTP into your server and login to the WordPress root installation.Delete the .maintenance file. And your site will come back online.

Go to WP Admin to see if WordPress asking for a database upgrade. If WordPress doesn’t ask for a database upgrade, you can login.

Moving WordPress blog from a subdomain to a subfolder

I had this blog and this main site on same domain, pixert.com a year ago. I got high traffic to same domain.

I separated the blog from main site after serious problems occurred. I made blog.pixert.com for blog and pixert.com for main site
That’s a mistake I should  not done.

Most startups have their blog on a separate sub domain like blog.pixert.com or blog.[your_domain].com
The thought of we could optimize it for SEO through the sub domain was wrong.
The traffic to the blog and the site lower than it was on same domain, pixert.com.

I decided to merge blog.pixert.com to pixert.com, I’m moving the blog to pixert.com/blog or [your_domain].com/blog .
It’s a delicate process to move blog.pixert.com to pixert.com. My concern in traffic from Google, the old URLs redirect to the new site

1. Disable a Caching plugin installed on the site
Delete the cache and disable that plugin

2. Change WordPress address (URL) and Site address (URL)
I change  WordPress address (URL) and Site address (URL) from blog.pixert.com to pixert.com/blog. This is a simply a matter of updating WordPress address and Blog address options from within the WordPress administration panel (Settings ->General)

3. Update Permalink structure.
Don’t forget to save Permalinks once more to make sure your WordPress site run smoothly. No need to change settings if you want to keep up same settings

3. Change Sub Domain root in cPanel
I created the blog subfolder in cPanel. The blog sub domain maps to a directory in the webroot called /blog/, however this directory been used by the new URL, pixert.com/blog.
I change the document root so I can apply redirection. If someone visits a link to a page that includes the sub domain, the web server will tell the browser that new site.

4. Redirect old URLs to the new URL via .htaccess
Create new .htaccess on new Sub Ddomain root, add the following

<pre>Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^blog.your_domain.com [nc]
rewriterule ^(.*)$ http://www.your_domain.com/blog/$1 [r=301,nc]</pre>

If someone tries to visit, http://blog.pixert.com/web-page-compression-enable-gzip-encoding-and-caching/, the server will (301) redirect to http://pixert.com/blog/web-page-compression-enable-gzip-encoding-and-caching/

5. Remove the old blog subdomain from Google Webmaster Tools
6. Submit all sitemaps from new URL through [your_domain].com account to Google using Google Webmaster Tools.

Limiting Access to Admin folder via .htaccess

Some CMS have admin folder. It’s an important folder because it has all the files that deal with administration. If the security of the files in it is compromised, bad things can happen.

One effective option to reducing the risk of a security breach on the Admin folder is by limiting the IP addresses that can access it via an htaccess file. This is for Apache Web Servers.

Creat a new blank documentin your favorite text our source code editor. Save that file with the name : .htaccess

1. Find your IP address via this site, What is My IP Address

2. Place the following directives in .htaccess file


AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "Admin Access Control"
AuthTypeBasic
<LIMIT GET>
order deny, allow
deny from all
#white list IP
allow from xxx.xxx.xxx.xxx
</LIMIT>

3. Upload .htaccess file to Admin folder. Do not upload it to root folder

This option is nice and tightens the security, but its’ inconvenient if you work from multiple locations with different IP addresses or non-static IP environment

How to get Administrator access back in WordPress?

Your role was Administrator. Suddenly, someone has changed your role in WordPress.
You login to WordPress admin as a subscriber,you see  Profile page instead getting fully-functional Admin page.   How to get your role as an Administrator back?

1. Get help from another Administrator

You can ask another Administrator to switch your current role back to Administrator.
Login to WordPress Admin.  Go to Users section on the left sidebar of WordPress Dashboard page.
Click Users.  Edit your username. Change your current role from Subscriber to Administrator.
Click Update Profile button. Logout from WordPress Admin. Login again with your username.

2. PhpMyAdmin

Most Control Panel has PhpMyAdmin feature in it. Open PhpMyAdmin.
Find wp_usermeta table in the left sidebar of PhpMyAdmin. Click it.
Click Browse tab, you’ll get all content of the table.

See your nickname, there’s meta_key name wp_capabilities under that nickname.
Change meta_value from

a:1:{s:10:"subscriber";s:1:"1";}

to

a:1:{s:13:"administrator";b:1;}

Save the new meta value .