Linux user permission right way

To solve linux user and group permission issue for any kind of project.

First of all find the right user and right group which is executing that process.

Silver bullet of linux user permission.

    sudo lsof -iTCP -sTCP:LISTEN -Pn
    export OWENRE=$(whoami)
    export GROUP=$(whoami)

Use above command to grap process and find whois the right owner of that process and export variable as OWENRE and GROUP

    sudo chgrp $GROUP * -Rf
    sudo chown $OWENRE * -Rf
    sudo find ./ -type f -exec chmod 664 {} \;    
    sudo find ./ -type d -exec chmod 775 {} \;

Rre-read image for more understandin...

Htaccess file for any project

Quick , Easy and Fast .htaccess for any kind of project.

    RewriteEngine On
    # The following rule tells Apache that if the requested filename
    # exists, simply serve it.
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    # The following rewrites all other queries to index.php. The
    # condition ensures that if you are using Apache aliases to do
    # mass virtual hosting, the base path will be prepended to
    # allow proper resolution of the index.php file; it will work
    ...

Htaccess file for WordPress

    ### Htaccess file for WordPress project.
    # 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

If you want to force http request to https then add following code after RewriteEngine on

    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]