Saturday, November 18, 2017

Most Useful .htaccess Tricks for WordPress website

Most Useful .htaccess Tricks for WordPress website

Some most useful .htaccess tricks for your WordPress website are here. Wordpress needs htaccess to work perfectly and runs smoothly.

Here is the htaccess code for a basic wordpress site:

# 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 are using Localhost, for example:
http://localhost/codingsparks

Then htaccess is...

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /codingsparks/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /codingsparks/index.php [L]
</IfModule>
# END WordPress



Wordpress MultiSite htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]


Reference Link: https://codex.wordpress.org/htaccess

Friday, November 17, 2017

How to avoid Access-Control-Allow-Origin error using htaccess

How to avoid Access-Control-Allow-Origin error using htaccess

Add the below code in you .htaccess file.

#avoid Access-Control-Allow-Origin error using htaccess
<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>

Update Php.ini values from htaccess

Add the below code to change the default php.ini settings

1) Upload Max Filesize
2) Post Max Size 
3) Max Execution Time 
4) Max Input Time 
5) Memory Limit 


#Update Php.ini values from htaccess
php_value upload_max_filesize 512M
php_value post_max_size 512M
php_value max_execution_time 600
php_value max_input_time 600
php_value memory_limit 512M


we can also update in php.ini or .user.ini.

Wednesday, November 15, 2017

Remove public from Laravel using htaccess

Remove public from Laravel using htaccess

RewriteEngine On

# Remove all trailing slashes 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*)/$
RewriteRule ^ /%1 [R=301,L]

RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]


Ionic framework Basics - 1

Ionic framework Basics - 1 1. Install Node.js check node js is installed Goto CMD   > type npm --> to check node js is inst...