Skip to main content

Posts

Showing posts from 2021

CakePHP bin cake: Permission denied terminal error

 CakePHP bin/cake: Permission denied error in terminal/cmd Sometimes when we try to run commands on our server or on linux system , terminal gives error like bin/cake: Permission denied and even if we logged in as a root user, still its gives error. To solve this error please run below command, that will give permission to bin/cake folder  chmod +x bin/cake The above command will work for CakePHP 3 and 4 , and if you are using old version then try to run below command chmod +x Console/cake After running above commands , CakePHP will allow to run commands through terminal Thank you

Laravel - Remove public from url

Solution - Laravel How to Remove /public from url Laravel is a most popular PHP framework and today we will solve most common issue with laravel  by removing /public from URL. This code is tested with Laravel 8(Latest) but it will work with Laravel 7, 5 version also. ISSUE When we move our site on live server and do not run our application through terminal and try to access website by entering url then we need to add /public to run it successfully, But its not good to keep /public in our website url that will not seo friendly and creates bad user experience. SOLUTION FOR LARAVEL REMOVE PUBLIC FROM URL Create a .htaccess file on your root directory and paste below code into .htaccess file and save it. try this code <IfModule mod_rewrite.c>     RewriteEngine On     RewriteRule ^(.*)$ public/$1 [L] </IfModule> or this one RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ ^$1 [N] RewriteCond %{REQUEST_URI} (\.\w+$) [NC] Re

WP Error Fix - The Link You Followed Has Expired

 WP Error Fix - The Link You Followed Has Expired     This WordPress error is common and mostly it comes when we try to upload a theme or plugins. WordPress gives this error because by default our server have fixed limit for max file upload , post size etc and because of this reason , when we try to upload a large size file PHP generates error like this. How to solve this error WP Error Fix - The Link You Followed Has Expired To solve this issue, we need to increase php size limit and we have several ways to do this 1. fix 'The Link You Followed Has Expired' wp error using .htaccess file This is the best and easy solution to fix this error and increase memory limit, post size, upload size etc. First go to your root directory of your project and check if you have .htaccess file exist or not, if its exist then edit it and add below code at the end of the file or if you do not have a .htaccess file in root directory then create a new one and edit and paste below code in it. php_va

Cron job Schedule tasks in Plesk Panel Windows

How to run Cronjob or Schedule tasks in Plesk Panel Windows Cron job or Schedule Tasks Cron job and schedule tasks both are same functions that runs a script periodically. Both mostly use to hit an url with a time interval for example we want to deactivate users account  after 1 month of registration  in our website, So for this type of task we need to schedule a script so that script will run everyday on a certain time and check if user registration is expired or not and if its expired , then users account status will update. Difference between Cronjob and Schedule Tasks Cronjob mostly run scripts on linux servers in the terminal but Schedule Tasks gives us option to hit an url , run a PHP script or run a command etc. How to schedule tasks in plesk panel First login to your plesk panel and in the right bar you can see Schedule tasks option like below screenshot Then Click on Add Task button to schedule a cronjob task in Plesk panel Now you will see a screen like below. Here for this t

Redirect www to non www url using htaccess

 Redirect www to non www url using htaccess   sSometimes we can access our website on both url like https://www.learncodetoday.com and https://learncodetoday.com , but its not good for SEO. So today we will learn how can we redirect a user from www to non-www url using htaccess. .htaccess file is a routing file that you can find on your project root folder and if its not exist there then you can create a .htaccess file there. Copy and paste below code into your .htaccess file for redirection RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteCond %{ENV:HTTPS} !on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] Now save file and try to open your website by using www url and it will auto redirect you on non-www url. Related Links How to remove www from url .htaccess to redirect an url Redirect my domain from www to non www domain url