Wednesday, 3 April 2013

How to Fix WordPress Posts Returning 404 Error

WordPress is a powerful CMS. Sometimes a slight tweak can make your website inaccessible. However, finding a solution for any WordPress problem is extremely easy. Common problem that most WordPress users face at some point is WordPress posts returning a 404 Error. In this article we will show you how to fix WordPress posts returning 404 error.

Usually in this scenario a user can access their WordPress admin area, their blog’s main page, but when accessing a single posts they get a 404 Not found error. First of all, don’t panic most of the time your posts are still there and completely safe. This usually happens if your .htaccess file got deleted or something went wrong with the rewrite rules. What you need to do is fix your permalinks settings.

Go to Settings » Permalinks, and simply click on Save Changes button. 


 This will update your permalinks settings and flush rewrite rules. In most cases this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you probably need to update your .htaccess file manually.

Login to your server using FTP, and modify the .htaccess file which is located in the same location where folders like /wp-content/ and /wp-includes/ are located. The easiest thing you can do is to temporarily make the file writeable by changing the permissions to 666. Then repeat the original solution. Don’t forget to change the permissions back to 660. You can also manually add this code in your .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
 

We hope this article helped you resolve posts returning 404 error in WordPress.

How to Grant Remote Access to a MySQL Database

So you’ve just created a user in MySQL, but the user cannot log in, even when using the correct password. What’s the problem?
Generally MySQL users can access the server from the server itself, or from the same network subnet. Remote access to MySQL (through the Internet, or from another private network) must be granted as through a special process.


Granting Remote Access to MySQL:
The database administrator grants permission for the user to access the server from all of the remote locations where the user is authorized.

A detailed discussion of remote access is found in the MySQL 5.1 Reference Manual, however, some simplified steps are here:


1. Log in to MySQL as an administrator. This must be done by command line. Enter the following command from a shell prompt:


mysql -u admin –p

Enter the admin password when prompted.

2. From the MySQL prompt, grant the user access to a specific database schema. The general format of the command to use is:

GRANT ALL PRIVILEGES ON database.* to ‘user’@'yourremotehost' IDENTIFIED BY 'newpassword';

Where:

‘user’ is the user name of an existing MySQL account. The username is enclosed in single quotes, as shown.

database is the name of the database schema where access will be granted. Either the name of the schema can be used, or an asterisk (*) can be used to specify all databases.

‘yourremotehost’ contains either an IP address where the user will access from, or a domain name. The IP address or host name must appear in single quotes, as shown.

‘newpassword’ contains the password the user must use to access the server. The password must appear in single quotes as well.


3. To force the changes to take effect immediately, enter the following command:

FLUSH PRIVILEGES;

Specific Examples:

Example A: Granting access for the user jsmith from an IP address:
GRANT ALL PRIVILEGES ON mydatabase.* to jsmith@'69.234.27.102' IDENTIFIED BY 'jimspassword';

Example B: Granting access from a domain:
GRANT ALL PRIVILEGES ON mydatabase.* to jsmith@'%.mycompany.com' IDENTIFIED BY 'jimspassword';

Example C: Granting access to all schemas:
GRANT ALL PRIVILEGES ON *.* to jsmith@'69.234.27.102' IDENTIFIED BY 'jimspassword';

Example D: Granting access from a specific host name on a domain:
GRANT ALL PRIVILEGES ON *.* to jsmith@'jimspc.mycompany.com' IDENTIFIED BY 'jimspassword';

Monday, 1 April 2013

How to add a new Theme to WordPress installation

To add a new Theme to your WordPress installation, follow these basic steps:

1. Download the Theme archive and extract the files it contains. You may need to preserve the directory structure in the archive when extracting these files. Follow the guidelines provided by your Theme author.


2. Using an FTP client to access your host web server, create a directory to save your Theme in the wp-content/themes directory provided by WordPress. For example, a Theme named Test should be in wp-content/themes/test. Your Theme may provide this directory as part of the archive.


3. Upload the Theme files to the new directory on your host server.


4. Follow the instructions below for selecting the new Theme.

Adding New Themes by using cPanel

If your host offers the cPanel control panel, and the Theme files are in a .zip or .gz archive follow these instructions. Note: This assumes the Theme you download is a compressed (zip) file and the files in the zip file are in their 'named' folder.

1. Download the Theme zip file to your local machine.


2. In cPanel File Manager, navigate to your Themes folder. If you have WordPress installed in it's own folder called wordpress, you would navigate to "public_html/wordpress/wp-content/themes" and if WordPress is installed in your web-root folder you would navigate to "public_html/wp-content/themes".


3. Once you've navigated to the Themes folder in cPanel File Manager, click on Upload file(s) and upload that zip file you saved in Step 1.


4. Once the zip file is uploaded, click on the zip file name in cPanel, then in the panel to the right, click on Extract File Contents, and that zip file will be uncompressed.


5. Follow the instructions below for selecting the new Theme.

Adding New Themes using the Administration Panel

You can download Themes directly to your blog by using the Add New Themes option in the Appearance sub-menu.

1. Log in to the WordPress Administration Panel.
2. Select the Appearance panel, then Themes.
3. Select Install Themes
4. Use the sub-menu or the Search or Filter options to locate a Theme you would like to use.
5. Click on the Preview link to preview the Theme or the Install link to upload the Theme to your blog.
6. Use the Upload link in the top sub-menu to upload a zipped copy of a Theme that you have previously downloaded to your machine.

Selecting the Active Theme

To select a Theme for your site:

1. Log in to the WordPress Administration Panel.
2. Select the Appearance panel, then Themes.
3. From the Available Themes section, click on the Theme title (or Theme screenshot) for the Theme you wish to activate.
4. A preview of the Theme will be shown.
5. To activate the Theme click the Activate "Theme Name" link in the top right.

Your selection should immediately become active.

Note: If the Theme preview is blank, do not activate the new Theme without investigating further. Your site may not be displayed correctly, otherwise.

Block IP from accessing website using .htaccess

Block IP from accessing website using .htaccess

To block certain ip address from accessing your website, just create a file with name .htaccess at your root directory with the content below:-

order allow,deny
deny from 192.168.0.1
allow from all

If you want to block multiple ip address using .htaccess simply add one ip address per line as below:-

order allow,deny
deny from 192.168.0.2
deny from 192.168.0.3
deny from 192.168.0.4
allow from all

You can even block a network range ip using .htaccess:-

order allow,deny
deny from 129.0.0
allow from all

Note: .htaccess only works in apache webserver, if you do not know what web server you are on, your can consult with your server administrator for more details.

Sending mail using telnet

The first thing to do is to open a connection from your computer to your mail server.

telnet mail.domain.ext 25

You will then need to declare where you are sending the email from:

HELO local.domain.name

Now give your email address:

MAIL FROM: mail@domain.ext

Now give the recipients address:

RCPT TO: mail@otherdomain.ext

To start composing the message issue the command DATA

If you want a subject for your email type Subjectype subject here- then press enter twice

You may now proceed to type the body of your message (e.g. hello mail@otherdomain.ext from mail@domain.ext)

To tell the mail server that you have completed the message enter a single "." on a line on it's own.

You can close the connection by issuing the QUIT command.

Unable to connect to pipe \\.\pipe\PSA_pipe

1. Identify which database provider is used to store Parallels Plesk Panel by looking up the value of the HKLM\SOFTWARE\Wow6432Node\Plesk\PSA Config\Config\PLESK_DATABASE_PROVIDER_NAME hive in the system registry:

2. Identify the status of the corresponding service:
C:\>sc query PleskSQLServer

SERVICE_NAME: PleskSQLServer
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0


3. Start it up:
sc start PleskSQLServer

ASP.NET Ajax client-side framework failed to load And\Or 'Sys' is undefined

There may be various reason behind this issue. Below are the couple of solutions which is worth trying :

Solution 1: A quick solution is to update your web.config and add following section

<handlers>
    <remove name="WebServiceHandlerFactory-Integrated"/>
    <remove name="ScriptHandlerFactory"/>
    <remove name="ScriptHandlerFactoryAppServices"/>
    <remove name="ScriptResource"/>
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" 
 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
 Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd"  
preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD"  
path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, 
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
 
Solution 2: Add the below code in <httpHandlers>
 
<add verb="GET"
  path="ScriptResource.axd"
  type="Microsoft.Web.Handlers.ScriptResourceHandler"
  validate="false"/>
 
Solution 3 : If you don't have this, add this too under <assemblies>
 
<add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
 PublicKeyToken=31bf3856ad364e35"/>
 
Solution 4 : f that doesn't work too, try deleting files from your "bin" folder
 and rebuild the solution and clear the cache of your browser.
 
Solution 5 : Add this to your web.config
 
<location path="ScriptResource.axd">
   <system.web>
      <authorization>
         <allow users="*"/>
      </authorization>
   </system.web>
</location>
 
Solution 6 : Repair .Net 3.5 SP1 installation from Control Panel - Add/Remove Programs,
as it may be possible an update to 3.5 SP1 can stop web-server delivering Ajax.
 
Final Solution 7 : this could be a caching/compression issue and by putting in the 
following into Web.Config, may resolves the issue. 
 
  <system.web.extensions>
    <scripting>
      <scriptResourceHandler enableCaching="false" enableCompression="false" />
    </scripting>
  </system.web.extensions>