WordPress best performance .htaccess file content

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript


#BEGIN EXPIRES HEADERS
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default expiration: 1 hour after request
ExpiresDefault "now plus 1 hour"
# CSS and JS expiration: 1 week after request
ExpiresByType text/css "now plus 1 week"
ExpiresByType application/javascript "now plus 1 week"
ExpiresByType application/x-javascript "now plus 1 week"
# Image files expiration: 1 month after request
ExpiresByType image/bmp "now plus 1 month"
ExpiresByType image/gif "now plus 1 month"
ExpiresByType image/jpeg "now plus 1 month"
ExpiresByType image/jp2 "now plus 1 month"
ExpiresByType image/pipeg "now plus 1 month"
ExpiresByType image/png "now plus 1 month"
ExpiresByType image/svg+xml "now plus 1 month"
ExpiresByType image/tiff "now plus 1 month"
ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
ExpiresByType image/x-icon "now plus 1 month"
ExpiresByType image/ico "now plus 1 month"
ExpiresByType image/icon "now plus 1 month"
ExpiresByType text/ico "now plus 1 month"
ExpiresByType application/ico "now plus 1 month"
# Webfonts
ExpiresByType font/truetype "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
</IfModule>
#END EXPIRES HEADERS

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
 <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
 Header set Cache-Control "max-age=2592000, public"
 </filesMatch>
 <filesMatch "\.(css)$">
 Header set Cache-Control "max-age=604800, public"
 </filesMatch>
 <filesMatch "\.(js)$">
 Header set Cache-Control "max-age=216000, private"
 </filesMatch>
 <filesMatch "\.(x?html?|php)$">
 Header set Cache-Control "max-age=600, private, must-revalidate"
 </filesMatch>
</ifModule>
# END Cache-Control Headers


# ENABLE LITESPEED CACHE START
<IfModule LiteSpeed>
CacheEnable public
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^GET|HEAD$
RewriteCond %{HTTP_HOST} ^sample.com|sample.net|sample.org [NC]
RewriteCond %{REQUEST_URI} !login|admin|register|post|cron
RewriteCond %{QUERY_STRING} !nocache
RewriteRule .* - [E=Cache-Control:max-age=300]
</IfModule>
# ENABLE LITESPEED CACHE END

# START ENABLE KEEP ALIVE
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
# END ENABLE KEEP ALIVE


<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters rewrite_css,combine_css
ModPagespeedEnableFilters recompress_images
ModPagespeedEnableFilters convert_png_to_jpeg,convert_jpeg_to_webp
ModPagespeedEnableFilters collapse_whitespace,remove_comments
</IfModule>

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

Step by step overview guide for setup business WhatsApp API

Step by step overview guide for setup business WhatsApp API with Facebook business account

What is the criteria to check my business Facebook is active for WhatsApp api

after that your WhatsApp api is fully activated.

  1. Must have Facebook business account setting
    a. WhatsApp account added into Facebook business setting
    b. Add system user
    c. Assign an App to system user via add assets
    d. Generate token for final use of WhatsApp api with selected permission
  2. Create app and add it into business Facebook account
    Note : for use WhatsApp api app type must be business

*Step by step overview guide for setup business WhatsApp API
*What is business WhatsApp API
*How to implement WhatsApp API

Download Hindi font google

Making the web more beautiful, fast, and open through great typography.

HindHind is an Open Source typeface supporting the Devanagari and …
नोटों साँस देवनागरीNoto is a global font collection for writing in all modern and …
MuktaMukta is a Unicode compliant, versatile, contemporary …
RobotoMaking the web more beautiful, fast, and open through great …

Download DevLys Hindi Fonts ( देवलिस फ़ॉन्ट्स )

DevLys 010  Download

DevLys 010 Bold  Download

DevLys 010 Bold Italic  Download

DevLys 010 Condensed  Download

DevLys 010 Thin  Download

DevLys 020  Download

DevLys 020 Condensed  Download

DevLys 020 Italic  Download

DevLys 020 Thin  Download

DevLys 020 Wide  Download

DevLys 030  Download

DevLys 030 Condensed  Download

DevLys 030 Italic  Download

DevLys 030 Wide  Download

DevLys 040 Bold  Download

DevLys 040 Condensed  Download

DevLys 040 Italic  Download

DevLys 040 Thin  Download

DevLys 040 Wide  Download

DevLys 050 Bold Italic  Download

DevLys 050 Condensed  Download

DevLys 050 Italic  Download

DevLys 050 Wide  Download

DevLys 060 Thin  Download

DevLys 060 Wide  Download

DevLys 070 Italic  Download

DevLys 070 Thin  Download

DevLys 070 Wide  Download

DevLys 080 Condensed  Download

DevLys 090 Bold Italic  Download

DevLys 090 Italic  Download

DevLys 090 Wide  Download

DevLys 100 Bold  Download

DevLys 100 Bold Italic  Download

DevLys 100 Italic  Download

DevLys 100 Thin  Download

DevLys 100 Wide  Download

DevLys 110 Bold  Download

DevLys 110 Bold Italic  Download

DevLys 110 Condensed  Download

DevLys 110 Thin  Download

DevLys 110 Wide  Download

DevLys 120  Download

DevLys 120 Bold Italic  Download

DevLys 120 Condensed  Download

DevLys 130 Condensed  Download

DevLys 130 Thin  Download

DevLys 140 Condensed  Download

DevLys 140 Wide  Download

DevLys 150 Condensed  Download

DevLys 150 Thin  Download

DevLys 160 Bold Italic  Download

DevLys 160 Italic  Download

DevLys 160 Wide  Download

DevLys 170  Download

DevLys 180 Condensed  Download

DevLys 190 Condensed  Download

DevLys 190 Italic  Download

DevLys 190 Thin  Download

DevLys 200 Condensed  Download

DevLys 200 Italic  Download

DevLys 200 Wide  Download

DevLys 210  Download

DevLys 210 Bold  Download

DevLys 210 Condensed  Download

DevLys 220 Condensed  Download

DevLys 220 Thin  Download

DevLys 220 Wide  Download

DevLys 230 Condensed  Download

DevLys 230 Italic  Download

DevLys 240  Download

DevLys 240 Italic  Download

DevLys 240 Thin  Download

DevLys 250 Italic  Download

DevLys 260 Bold  Download

DevLys 260 Condensed  Download

बिना नेटवर्क के कर सकेंगे कॉल

एप्पल इस साल सितंबर में अपनी आईफोन 4 सीरीज लॉन्च कर सकती है।

इस रिपोर्ट में पता चला है कि एप्पल आईफोन 4 के साथ सैटलाइट कम्युनिकेशन कनेक्टिविटी दे सकती है।

इसकी मदद से उपभोक्ता सिम का नेटवर्क ना आने पर भी कॉल और मैसेज कर सकेंगे खासकर इमरजेंसी के समय यह फीचर उपभोक्ताओं के लिए काफी मददगार साबित होगा।

change app type Facebook

App types cannot be changed. If your app needs products, permissions, or features that are unavailable to its current type you must create a new app with a different type instead.

How to run crontab job every week on Sunday

Here is an explanation of the crontab format.

# 1. Entry: Minute when the process will be started [0-60]
# 2. Entry: Hour when the process will be started [0-23]
# 3. Entry: Day of the month when the process will be started [1-28/29/30/31]
# 4. Entry: Month of the year when the process will be started [1-12]
# 5. Entry: Weekday when the process will be started [0-6] [0 is Sunday]
#
# all x min = */x

So according to this your 5 8 * * 0 would run 8:05 every Sunday.

30 18 * * * curl URL >/dev/null 2>&1
30 18 * * * curl URL >/dev/null 2>&1
30 18 * 1 * curl URL >/dev/null 2>&1
30 18 * * 1 curl URL >/dev/null 2>&1

Position 1 for minutes, allowed values are 1-60
position 2 for hours, allowed values are 1-24
position 3 for day of month ,allowed values are 1-31
position 4 for month ,allowed values are 1-12 
position 5 for day of week ,allowed values are 1-7 or and the day starts at Monday. 
crontab -e    for edit or add cron/scheduled job

crontab -l    for show list

how can i protect laravel api calling from other website

Access-Control-Allow-Origin https://mydomain.com/

 added a new middleware

<?php

namespace App\Http\Middleware;

use Closure;

class VerifyAPIAccess
{
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if (
            !(App::environment('local'))
            && (
                !$request->header('access-token')
                || $request->header('access-token') !== env('APP_API_TOKEN')
            )
        ) {
            return response()->json(['Message' => 'You do not access to this api.'], 403);
        }

        return $next($request);
    }
}

and then added to my route

Route::group([
    'middleware' => [
        VerifyAPIAccess::class,
 	'throttle:60,1'
    ]
], function () {

// list some routes

});

you could also restrict access by adding throttling which would stop someone from hammering your API, with token or not.

There are probably many approaches. A simple but effective one would be sessions. You can save the user in a session. This way you can also count his Api accesses. As soon as they are larger than allowed, you can block their requests. You also write the block in the session. But pay attention to the session duration. It must be long enough.

But the user with bad intentions can get a new session. To avoid this, you can also put his IP on an internal blacklist for a day.

Note: But an open api is always a point of attack.

Things tried:

  • Using passport to protect my routes and then use passport’s CreateFreshApiToken middleware. Protection works fine, unauthorized users are not able to access the routes, however I don’t get laravel_token in my cookies and therefore I can’t get access to that route if I’m not logged in.
  • Use passport’s client credentials grant access. Works fine and the way I want it to work but doesn’t really make sense because if I hardcode the client_secret – anyone can access it and then use it to access protected routes. If I make a proxy-like solution, to call a controller method, which would issue a valid token and thus not exposing client_secret to front-end but then anyone could just call that route which issues the token and it would be pointless once again.

You cannot stop people from trying to access of publicly visible API. You need to secure the API and only respond to those with the proper access privileges. 

429 too many requests laravel 8

I stumbled upon the same problem today and did some debugging. When registering the /login route, Fortify applies the Illuminate\Routing\Middleware\ThrottleRequests:login middleware to it. This means, for every request to that route, the ThrottleRequests middleware will call the RateLimiter instance for that specified key. Apparently, Fortify doesn’t register a RateLimiter for the login key.

Due to the missing key in the $limiters property of the RateLimiter instance, the ThrottleRequests middleware uses its default fallback, which doesn’t handle the edge case “there SHOULD be a rate limiter for that key, but there isn’t.” really well. The $maxAttempts variable is set to 0 and will result in flaky rate limiting behaviour.

I feel like this is a bug in Fortify, because rate limiting is also happening in the \Laravel\Fortify\Actions\EnsureLoginIsNotThrottled action, which is invoked in the \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController controller. I didn’t check this on a fresh Laravel installation, though, so I don’t want to jump to conclusions here.

Anyway, long story short: As a workaround, you can simply register a rate limiter for the “login” key in some of your providers, e. g. AppServiceProvider or AuthServiceProvider:

public function boot()
{
    RateLimiter::for("login", function () {
        Limit::perMinute(5);
    });
}

Edit: I just realized that the rate limiter for the “login” key is indeed provided by Fortify within the FortifyServiceProvider class. If you happen to have a problem similar to the one discussed above, make sure that you added the FortifyServiceProvider class to your providers array in the config/app.php.

source : stackoverflow

use of binding in kernel laravel 8

Route Model Binding

When injecting a model ID to a route or controller action, you will often query the database to retrieve the model that corresponds to that ID. Laravel route model binding provides a convenient way to automatically inject the model instances directly into your routes. For example, instead of injecting a user’s ID, you can inject the entire User model instance that matches the given ID.

Implicit Binding

Laravel automatically resolves Eloquent models defined in routes or controller actions whose type-hinted variable names match a route segment name. For example:

use App\Models\User;
 
Route::get('/users/{user}', function (User $user) {
    return $user->email;
});

Since the $user variable is type-hinted as the App\Models\User Eloquent model and the variable name matches the {user} URI segment, Laravel will automatically inject the model instance that has an ID matching the corresponding value from the request URI. If a matching model instance is not found in the database, a 404 HTTP response will automatically be generated.

Of course, implicit binding is also possible when using controller methods. Again, note the {user} URI segment matches the $user variable in the controller which contains an App\Models\User type-hint:

use App\Http\Controllers\UserController;
use App\Models\User;
 
// Route definition...
Route::get('/users/{user}', [UserController::class, 'show']);
 
// Controller method definition...
public function show(User $user)
{
    return view('user.profile', ['user' => $user]);
}