Published by Elvin D.

Forbidden Access to Website Resources

When you begin developing a website, I know how frustrating it is to encounter plenty of problems, one of those problems you will inevitably encounter is file permission issue. Moreover, you will encounter dialog box of messages as follows:

Forbidden
You don’t have permission to access this resource. Server unable to read htaccess file, denying access to be safe.

Read more..

Converting Linked Resources to HTTPS Upon Loading the Document Page Using jQuery

This is just a separate post to modifying linked resources to HTTPS when using DOM.

jQuery( document ).ready(function($) {
    // This will find links for `href` attributes and substitute url value
    str.replace(/(href[^http://]+)(?<=['\"])http(?=://)/gi, "$1https")

   // This will look for `src` attributes particularly images, JS scripts and replace the URL value
    str.replace(/(src[^http://]+)(?<=['\"])http(?=://)/gi, "$1https");

    // Find forms and look for `action` attributes and replace url value
    str.replace(/(action[^http://]+)(?<=['\"])http(?=://)/gi, "$1https");
});
Read more..

Forcing Resources to HTTPS for Better Security via htaccess

If you are running a website be it a personal blog or corporate website, most browsing client like Chrome and Mozilla are requiring you to use a secure web protocol HTTPS. Moreover, Google will be giving priority to those sites that are already in HTTPS from Search Engine Optimisation aspect.

Amending your website resources to use a secure protocol is a bit tricky but this article will guide you to do some tricks in Apache configs in .htaccess file.

The regex codes below are using mod_substitute apache module:

This will find links for href attributes and substitute url value

Substitute "s|(href[^http://]+)(?<=['\"])http(?=://)|$1https|"

This will look for src attributes particularly images, JS scripts and replace the url value

Substitute "s|(src[^http://]+)(?<=['\"])http(?=://)|$1https|"

Find forms and look for action attributes and replace url value

Substitute "s|(action[^http://]+)(?<=['\"])http(?=://)|$1https|"

I may gonna miss some other resources and other points, just feel free to comment below. Also for those resources that are using DOM, you can also use a jQuery to modify it e.g. when the document is loading modify links that are generated by DOM.

Read more..

Enabling FTP in XAMPP

You may wonder how to access web server via FTP when you are running XAMPP client or virtual linux OS running a server stack; well, the guide below may be helpful for you.

You have to create FTP user via terminal commands and give a file permission to where your web file resides.

Assuming you have XAMPP running by clicking Start button in General tab. In Services tab, make sure ProFTPD is also running as small circle turns green as indicator or just enable by clicking Start All button.

Read more..