Moh

php

40 PHP Tips

1. Do not use relative paths, instead define a ROOT path 2. Don’t use require , include , require_once or include_once 3. Maintain debugging environment in your application 4. Propagate status messages via session 5. Make your functions flexible 6. Omit the closing php tag if it is the last thing in a script 7. […]

40 PHP Tips Read More »

AWS Naming Convention

When naming AWS resources, including instances, volumes, snapshots, and other resources, it’s important to follow a consistent naming convention that helps with organization, identification, and management. Here are some general guidelines for creating AWS resource names: Be descriptive: Use names that clearly indicate the purpose, function, or characteristics of the resource. This helps in understanding

AWS Naming Convention Read More »

Deploy Laravel 11 project on Shared Hosting, the Easiest Way

Are you hosting a Laravel 11  project on your server but struggling to access it directly from your domain? Fear not, as configuring Apache redirect rules can seamlessly direct traffic to your Laravel project folder.  after archiving and uploading your Laravel project to your cPanel  Follow these steps to set up the redirect rules via

Deploy Laravel 11 project on Shared Hosting, the Easiest Way Read More »

Cloudflare pages, multiple “projects” with a single GitHub repo

I have in a single repository, several projects in subdirectories, each corresponding to a different site, this option would be important for me not to need to create several different repositories, each containing a single site. It can be done, although it’s not at all documented. Two steps: add the domain you want to use

Cloudflare pages, multiple “projects” with a single GitHub repo Read More »

Understanding CSRF Protection in Laravel

CSRF attacks occur when an attacker tricks a user’s browser into making an unintended request. To counteract this threat, Laravel includes CSRF protection by default. The framework generates unique CSRF tokens for each user session, and these tokens are validated on the server side for specific types of requests.     Login Response (Laravel to

Understanding CSRF Protection in Laravel Read More »

How to Disable Direct IP Access in Nginx (HTTP & HTTPS)

Find out how to use Nginx to disable direct IP access to your websites. In particular, I’ll cover these three solutions that will turn away users, malicious or not, when they try to access your server via IP:- ssl_reject_handshake approach for Nginx 1.19.4 and newer (recommended solution) Self-signed SSL certificate approach for Nginx older than

How to Disable Direct IP Access in Nginx (HTTP & HTTPS) Read More »

Laravel’s whereBetween not including date from

It is working as expected. The problem you are encountering is primarily that you are asking for the time between the exact same timestamp. While you are only specifying a specific day and not a time, a time is being included. In this case it is most likely exactly midnight. So ’20-05-2017′ becomes ’20-05-2017 00:00:00′. In this case

Laravel’s whereBetween not including date from Read More »

from scratch and explain the process of configuring Apache to allow or deny the use of .htaccess files in detail.

  Let’s start from scratch and explain the process of configuring Apache to allow or deny the use of `.htaccess` files in detail. **What is `.htaccess`?** `.htaccess` is a configuration file used by the Apache web server. It allows you to configure various aspects of how your web server behaves for specific directories and files.

from scratch and explain the process of configuring Apache to allow or deny the use of .htaccess files in detail. Read More »