{"id":1353,"date":"2025-02-24T18:30:20","date_gmt":"2025-02-24T18:30:20","guid":{"rendered":"https:\/\/hosting-marketers.com\/news\/?p=1353"},"modified":"2025-02-24T19:41:46","modified_gmt":"2025-02-24T19:41:46","slug":"how-to-secure-your-wordpress-and-laravel-sites-on-a-hosting-marketers-shared-accounts","status":"publish","type":"post","link":"https:\/\/hosting-marketers.com\/news\/2025\/02\/24\/how-to-secure-your-wordpress-and-laravel-sites-on-a-hosting-marketers-shared-accounts\/","title":{"rendered":"How to Secure Your WordPress and Laravel Sites on a Hosting Marketers Shared Accounts"},"content":{"rendered":"\n<p>Website security is critical for protecting your data, preventing hacks, and ensuring your site runs smoothly. While your hosting provider has <strong>CSF Firewall<\/strong> to protect the server from external threats, <strong>securing your WordPress or Laravel site is your responsibility<\/strong>.<\/p>\n\n\n\n<p>Many hacks happen because of <strong>poor security practices<\/strong>\u2014such as outdated plugins, weak passwords, and misconfigured files. In this guide, we&#8217;ll walk through <strong>essential security measures<\/strong> and <strong>how to use the <code>.htaccess<\/code> file<\/strong> to protect your site.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. Understanding the <code>.htaccess<\/code> File and Its Role in Security<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What is the <code>.htaccess<\/code> File?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>.htaccess<\/code> file (Hypertext Access) is a <strong>hidden configuration file<\/strong> used by Apache servers.<\/li>\n\n\n\n<li>It controls <strong>security settings, redirects, access restrictions, and caching<\/strong>.<\/li>\n\n\n\n<li>By default, <strong>it is hidden in the File Manager<\/strong>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to View the <code>.htaccess<\/code> File in cPanel<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Log in to cPanel<\/strong> and open the <strong>File Manager<\/strong>.<\/li>\n\n\n\n<li>Navigate to your website\u2019s root directory (<code>public_html<\/code> for WordPress, <code>public\/<\/code> for Laravel).<\/li>\n\n\n\n<li>Click the <strong>Settings<\/strong> button in the top-right corner.<\/li>\n\n\n\n<li>Check the box <strong>&#8220;Show Hidden Files (dotfiles)&#8221;<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Save<\/strong>\u2014now you will see the <code>.htaccess<\/code> file.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How <code>.htaccess<\/code> Helps Secure Your Website<\/strong><\/h3>\n\n\n\n<p>With <code>.htaccess<\/code>, you can: ? <\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>Block access to sensitive files<\/strong> (e.g., <code>wp-config.php<\/code>, <code>.env<\/code>).<br \/><strong>Disable directory browsing<\/strong> to prevent hackers from seeing your files.<br \/><strong>Prevent PHP execution in vulnerable folders<\/strong>.<br \/><strong>Restrict bot spam and brute-force attacks<\/strong>.<\/p>\n\n\n\n<p>Let\u2019s explore how to use <code>.htaccess<\/code> for better security.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2. Securing WordPress with <code>.htaccess<\/code><\/strong><\/h2>\n\n\n\n<p>Hackers <strong>target WordPress<\/strong> because of its popularity. With a few simple <code>.htaccess<\/code> tweaks, you can <strong>make your site significantly more secure<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>A. Restrict Access to wp-config.php<\/strong><\/h3>\n\n\n\n<p>The <code>wp-config.php<\/code> file contains <strong>database credentials<\/strong> and must be protected.<\/p>\n\n\n\n<p><strong>Solution:<\/strong> Add this to your <code>.htaccess<\/code> file in the root directory (<code>public_html<\/code>):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;Files wp-config.php&gt;<br \/>    Require all denied<br \/>&lt;\/Files&gt;<code><br \/><\/code><\/pre>\n\n\n\n<p><strong>This prevents unauthorized access<\/strong> to the most sensitive file in WordPress.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>B. Disable Directory Browsing<\/strong><\/h3>\n\n\n\n<p>If a hacker visits a folder without an <code>index.php<\/code> file, they might see <strong>all the files inside<\/strong>.<\/p>\n\n\n\n<p><strong>Solution:<\/strong> Prevent this by adding:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Options All -Indexes<br \/><\/code><\/pre>\n\n\n\n<p>Now, if someone tries to access a directory, they will see a <strong>403 Forbidden error<\/strong> instead.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>C. Block XML-RPC to Prevent Brute-Force Attacks<\/strong><\/h3>\n\n\n\n<p>WordPress <strong>XML-RPC<\/strong> allows remote connections, but <strong>hackers exploit it for brute-force attacks<\/strong>.<\/p>\n\n\n\n<p><strong>Solution:<\/strong> Disable it with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;Files xmlrpc.php&gt;<br \/>    Require all denied<br \/>&lt;\/Files&gt;<br \/><\/code><\/pre>\n\n\n\n<p>If you don\u2019t use <strong>Jetpack<\/strong> or external WordPress apps, <strong>this should be disabled<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>D. Restrict Access to wp-includes<\/strong><\/h3>\n\n\n\n<p>The <code>wp-includes<\/code> folder contains <strong>core WordPress files<\/strong>. Hackers try to inject malicious scripts here.<\/p>\n\n\n\n<p><strong>Solution:<\/strong> Block access by adding this to <code>.htaccess<\/code> in the root directory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;IfModule mod_rewrite.c&gt;<br \/>    RewriteEngine On<br \/>    RewriteBase \/<br \/>    RewriteRule ^wp-includes\/ - [F,L]<br \/>&lt;\/IfModule&gt;<br \/><\/code><\/pre>\n\n\n\n<p>This prevents direct access to the <code>wp-includes<\/code> folder.<\/p>\n\n\n\n<p><strong>If there is no <code>.htaccess<\/code> file in <code>wp-includes\/<\/code>, create one<\/strong> and add the above code.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>E. Prevent PHP Execution in wp-content\/uploads<\/strong><\/h3>\n\n\n\n<p>The <code>wp-content\/uploads\/<\/code> folder stores images and files <strong>but should never execute PHP scripts<\/strong>.<\/p>\n\n\n\n<p><strong>If there is no <code>.htaccess<\/code> file in <code>wp-content\/uploads\/<\/code>, create one<\/strong> by:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Opening cPanel File Manager<\/strong>.<\/li>\n\n\n\n<li><strong>Navigating to<\/strong> <code>\/wp-content\/uploads\/<\/code>.<\/li>\n\n\n\n<li><strong>Creating a new file<\/strong> named <code>.htaccess<\/code>.<\/li>\n\n\n\n<li><strong>Adding this code:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;FilesMatch \"\\.(php|phtml|php3|php4|php5|php7|php8)$\"&gt;<br \/>    Require all denied<br \/>&lt;\/FilesMatch&gt;<br \/><\/code><\/pre>\n\n\n\n<p>?<strong>This ensures only media files can be accessed<\/strong>, preventing <strong>malware execution<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>F. Prevent PHP Execution in wp-content<\/strong><\/h3>\n\n\n\n<p><strong>Some plugins store files inside <code>wp-content\/<\/code>.<\/strong> Hackers may try to <strong>run PHP scripts in these directories<\/strong>.<\/p>\n\n\n\n<p>? <strong>If there is no <code>.htaccess<\/code> file in <code>wp-content\/<\/code>, create one<\/strong> and add:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;FilesMatch \"\\.(php|phtml|php3|php4|php5|php7|php8)$\"&gt;<br \/>    Require all denied<br \/>&lt;\/FilesMatch&gt;<br \/><\/code><\/pre>\n\n\n\n<p><strong>This stops hackers from running unauthorized PHP scripts<\/strong> in <code>wp-content\/<\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>G. Set Up Browser Caching for Security &amp; Performance<\/strong><\/h3>\n\n\n\n<p><strong>This prevents browsers from reloading unnecessary resources<\/strong>.<\/p>\n\n\n\n<p><strong>Solution:<\/strong> Add this to <code>.htaccess<\/code> in the root directory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;IfModule mod_expires.c><br \/>    ExpiresActive on<br \/>    ExpiresByType text\/css \"access plus 1 year\"<br \/>    ExpiresByType image\/jpeg \"access plus 1 year\"<br \/>    ExpiresByType image\/png \"access plus 1 year\"<br \/>    ExpiresByType text\/javascript \"access plus 1 year\"<br \/>&lt;\/IfModule><br \/><\/code><\/pre>\n\n\n\n<p>This improves <strong>performance and security<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>3. Best Practices for WordPress Security<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Always Update WordPress, Plugins, and Themes<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Why?<\/strong> Outdated software is the <strong>#1 cause of hacks<\/strong>.<\/li>\n\n\n\n<li><strong>How?<\/strong> Go to <code>Dashboard &gt; Updates<\/code> and update everything regularly.<\/li>\n\n\n\n<li>Enable <strong>automatic updates<\/strong> for security patches.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Delete Unused Plugins and Themes<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Inactive themes\/plugins<\/strong> can still be hacked.<\/li>\n\n\n\n<li>They <strong>consume server resources<\/strong> and <strong>increase security risks<\/strong>.<\/li>\n\n\n\n<li>Go to <code>Appearance &gt; Themes<\/code> and <code>Plugins &gt; Installed Plugins<\/code> to delete unused ones.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Use a Security Plugin<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Wordfence<\/strong>, <strong>iThemes Security<\/strong>, or <strong>Sucuri Security<\/strong> can:\n<ul class=\"wp-block-list\">\n<li><strong>Monitor login attempts<\/strong> and <strong>block suspicious activity<\/strong>.<\/li>\n\n\n\n<li><strong>Scan for malware<\/strong>.<\/li>\n\n\n\n<li><strong>Enable two-factor authentication (2FA)<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>4. Regular Backups: Your Last Line of Defense<\/strong><\/h2>\n\n\n\n<p>No matter how secure your site is, <strong>always have backups<\/strong> in case something goes wrong.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Recommended Backup Methods:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>cPanel &gt; Backup Wizard<\/strong> (Manual backups).<\/li>\n\n\n\n<li><strong>UpdraftPlus (WordPress Plugin)<\/strong> for automatic backups.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Final Thoughts<\/strong> For WordPress<\/h2>\n\n\n\n<p>Securing your WordPress website <strong>is not difficult<\/strong>, but it <strong>requires ongoing effort<\/strong>.<\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>Protect <code>.htaccess<\/code>, <code>wp-config.php<\/code>, <code>.env<\/code><\/strong><br \/><strong>Disable unnecessary scripts (XML-RPC, directory browsing, PHP execution in storage)<\/strong><br \/><strong>Update regularly &amp; delete unused themes\/plugins<\/strong><br \/><strong>Use security plugins (Wordfence, iThemes Security, Laravel Rate Limiting)<\/strong><br \/><strong>Perform regular backups<\/strong><\/p>\n\n\n\n<p>Even though <strong>your hosting provider, Hosting Marketers, has CSF Firewall<\/strong>, website security is <strong>your responsibility<\/strong>. Follow these best practices, and your site will be <strong>far less vulnerable to attacks<\/strong>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><br \/><br \/><strong>Securing Laravel Websites on Apache and Nginx Servers<\/strong><\/h1>\n\n\n\n<p>Laravel is one of the most secure PHP frameworks, but <strong>misconfigured settings, exposed files, and weak authentication<\/strong> can still lead to vulnerabilities. Whether you&#8217;re running <strong>Apache<\/strong> or <strong>Nginx<\/strong>, you must take <strong>extra security measures<\/strong> to protect your application.<\/p>\n\n\n\n<p>Your hosting server already has <strong>CSF Firewall<\/strong>, but <strong>you need to harden your Laravel application<\/strong> to prevent common attacks like <strong>SQL injection, file uploads, unauthorized access, and brute-force login attempts<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. Protect the <code>.env<\/code> File<\/strong><\/h2>\n\n\n\n<p>The <code>.env<\/code> file stores <strong>database credentials, API keys, and application settings<\/strong>. If exposed, attackers can <strong>steal sensitive data and take over your site<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Apache (Add to <code>.htaccess<\/code> in Laravel Root)<\/strong><\/h3>\n\n\n\n<p>? <strong>If there is no <code>.htaccess<\/code> file in the Laravel root directory, create one<\/strong> and add:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;FilesMatch \"^\\.env$\"&gt;<br \/>    Require all denied<br \/>&lt;\/FilesMatch&gt;<br \/><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Nginx (Add to Server Block)<\/strong><\/h3>\n\n\n\n<p>For <strong>Nginx users<\/strong>, edit your site&#8217;s configuration file (e.g., <code>\/etc\/nginx\/sites-available\/yourdomain.com<\/code>) and add:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">location ~ \/\\.env {<br \/>    deny all;<br \/>}<code><br \/><\/code><\/pre>\n\n\n\n<p><strong>This ensures no one can access <code>yourdomain.com\/.env<\/code><\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2. Prevent PHP Execution in Storage and Public Uploads<\/strong><\/h2>\n\n\n\n<p>Laravel allows users to upload files, but <strong>hackers may try to upload malicious PHP scripts disguised as images<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Apache (Add <code>.htaccess<\/code> to <code>\/storage\/<\/code> and <code>\/public\/uploads\/<\/code>)<\/strong><\/h3>\n\n\n\n<p>? <strong>If there is no <code>.htaccess<\/code> file in these directories, create one<\/strong> and add:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;FilesMatch \"\\.(php|phtml|php3|php4|php5|php7|php8)$\"&gt;<br \/>    Require all denied<br \/>&lt;\/FilesMatch&gt;<br \/><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Nginx (Add to Server Block)<\/strong><\/h3>\n\n\n\n<p>For <strong>Nginx users<\/strong>, edit your site&#8217;s configuration file and add:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>location \/storage {<br \/>    location ~* \\.php$ {<br \/>        deny all;<br \/>    }<br \/>}<br \/><br \/>location \/public\/uploads {<br \/>    location ~* \\.php$ {<br \/>        deny all;<br \/>    }<br \/>}<br \/><\/code><\/pre>\n\n\n\n<p><strong>This stops hackers from running unauthorized PHP files inside storage and uploads folders<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>3. Disable Debug Mode in Production<\/strong><\/h2>\n\n\n\n<p>By default, Laravel&#8217;s <code>.env<\/code> file contains:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>APP_DEBUG=true<br \/><\/code><\/pre>\n\n\n\n<p><strong>Leaving <code>APP_DEBUG<\/code> enabled in production can expose sensitive errors to hackers<\/strong>.<\/p>\n\n\n\n<p><strong>Change it to <code>false<\/code> in <code>.env<\/code><\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>APP_DEBUG=false<br \/><\/code><\/pre>\n\n\n\n<p>This hides <strong>error messages<\/strong> that attackers could use to find vulnerabilities.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>4. Implement Rate Limiting to Prevent Brute-Force Attacks<\/strong><\/h2>\n\n\n\n<p>Laravel has built-in <strong>rate limiting<\/strong> to prevent hackers from making <strong>multiple login attempts<\/strong>.<\/p>\n\n\n\n<p> <strong>In <code>routes\/web.php<\/code>, apply rate limiting to login routes:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Route::middleware(['throttle:5,1'])-&gt;post('\/login', 'LoginController@login');<br \/><\/code><\/pre>\n\n\n\n<p>This <strong>limits login attempts to 5 per minute<\/strong>, reducing brute-force risks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Nginx: Limit Requests at the Server Level<\/strong><\/h3>\n\n\n\n<p>To <strong>further enhance security<\/strong>, add <strong>rate-limiting<\/strong> to your Nginx configuration:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>limit_req_zone $binary_remote_addr zone=login:10m rate=5r\/m;<br \/><br \/>server {<br \/>    location \/login {<br \/>        limit_req zone=login burst=10 nodelay;<br \/>    }<br \/>}<br \/><\/code><\/pre>\n\n\n\n<p><strong>This prevents bots from hammering your login page with repeated requests<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>5. Restrict Public Access to Laravel Folders<\/strong><\/h2>\n\n\n\n<p>By default, <strong>only the <code>\/public\/<\/code> folder should be accessible<\/strong> to visitors. Exposing other folders like <code>app\/<\/code>, <code>storage\/<\/code>, and <code>vendor\/<\/code> can <strong>lead to serious security risks<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Apache Users<\/strong><\/h3>\n\n\n\n<p>If Laravel is installed directly in <code>public_html\/<\/code>, <strong>move all files except the <code>\/public\/<\/code> folder to a subdirectory<\/strong>, such as:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/home\/youruser\/laravel_project\/<br \/>\/home\/youruser\/public_html\/  (Only contains Laravel\u2019s \/public folder)<code><br \/><\/code><\/pre>\n\n\n\n<p>Then, <strong>edit <code>index.php<\/code> inside <code>\/public\/<\/code><\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">require __DIR__.'\/..\/laravel_project\/bootstrap\/autoload.php';<br \/>$app = require_once __DIR__.'\/..\/laravel_project\/bootstrap\/app.php';<code><br \/><\/code><\/pre>\n\n\n\n<p><strong>This ensures only the public files are accessible<\/strong>, keeping your Laravel core files safe.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Nginx Users<\/strong><\/h3>\n\n\n\n<p>Edit your Nginx configuration and <strong>point the document root to the <code>\/public\/<\/code> folder only<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>server {<br \/>    listen 80;<br \/>    server_name yourdomain.com;<br \/>    root \/home\/youruser\/laravel_project\/public;<br \/><br \/>    index index.php index.html index.htm;<br \/><br \/>    location \/ {<br \/>        try_files $uri $uri\/ \/index.php?$query_string;<br \/>    }<br \/>}<br \/><\/code><\/pre>\n\n\n\n<p><strong>Now, only files inside <code>\/public\/<\/code> are accessible<\/strong>, preventing unauthorized access to Laravel&#8217;s core files.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>6. Force HTTPS for Secure Connections<\/strong><\/h2>\n\n\n\n<p>Always enforce <strong>HTTPS<\/strong> to <strong>prevent data interception<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Laravel (Edit <code>app\/Providers\/AppServiceProvider.php<\/code>)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>public function boot()<br \/>{<br \/>    if (config('app.env') === 'production') {<br \/>        \\URL::forceScheme('https');<br \/>    }<br \/>}<br \/><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>For Nginx (Force Redirect to HTTPS)<\/strong><\/h3>\n\n\n\n<p>Edit your Nginx configuration file and add:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>server {<br \/>    listen 80;<br \/>    server_name yourdomain.com;<br \/>    return 301 https:\/\/$host$request_uri;<br \/>}<br \/><\/code><\/pre>\n\n\n\n<p><strong>Now, all traffic is automatically redirected to HTTPS<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>7. Remove Unused Packages &amp; Keep Laravel Updated<\/strong><\/h2>\n\n\n\n<p>Unused packages <strong>increase security risks<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Check for Unused Packages<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>composer show --all<br \/><\/code><\/pre>\n\n\n\n<p>To remove an unused package:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>composer remove package-name<br \/><\/code><\/pre>\n\n\n\n<p><strong>Regular updates<\/strong> fix security vulnerabilities, so always run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>composer update<br \/><\/code><\/pre>\n\n\n\n<p><strong>Keeping Laravel updated ensures your site stays protected against new threats!<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Final Thoughts<\/strong><\/h2>\n\n\n\n<p>Laravel is a <strong>secure framework<\/strong>, but <strong>misconfigured settings can expose your application to attacks<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Summary of Key Security Steps:<\/strong><\/h3>\n\n\n\n<p><strong>Protect <code>.env<\/code> with <code>.htaccess<\/code> (Apache) or Nginx rules<\/strong><br \/><strong>Disable PHP execution in <code>storage\/<\/code> and <code>public\/uploads\/<\/code><\/strong><br \/><strong>Turn off <code>APP_DEBUG<\/code> in production<\/strong><br \/><strong>Enable rate limiting for login and API routes<\/strong><br \/><strong>Restrict access to core Laravel folders (Apache &amp; Nginx)<\/strong><br \/><strong>Force HTTPS for secure connections<\/strong><br \/><strong>Regularly update Laravel and remove unused packages<\/strong><\/p>\n\n\n\n<p>By implementing these steps, your Laravel application will be <strong>far more secure<\/strong> against attacks! ?<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Website security is critical for protecting your data, preventing hacks, and ensuring your site runs smoothly. While your hosting provider has CSF Firewall to protect the server from external threats, securing your WordPress or Laravel site is your responsibility. Many hacks happen because of poor security practices\u2014such as outdated plugins, weak passwords, and misconfigured files. [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":1354,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[88,2,158],"tags":[206,207],"class_list":["post-1353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-hosting-marketers-news","category-worpress-security","tag-websitesecurity-cybersecurity-onlinesafety-protectyourwebsite-securewebsites","tag-wordpresssecurity-wordpresstips-wpsecurity-wordpressprotection-securewordpress"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/02\/security.jpg?fit=1024%2C1024&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p9Yxzd-lP","jetpack-related-posts":[{"id":1367,"url":"https:\/\/hosting-marketers.com\/news\/2025\/04\/15\/12-essential-steps-to-secure-your-laravel-website-on-cpanel\/","url_meta":{"origin":1353,"position":0},"title":"12 Essential Steps to Secure Your Laravel Website on cPanel","author":"Admin","date":"April 15, 2025","format":false,"excerpt":"Laravel is a powerful and flexible PHP framework \u2014 but with that power comes responsibility. If you're running your Laravel application on a cPanel server, securing your environment is critical. At Hosting Marketers, we use LiteSpeed, CloudLinux, CPGuard, and Cloudflare, providing a robust foundation \u2014 but the app itself must\u2026","rel":"","context":"In &quot;security&quot;","block_context":{"text":"security","link":"https:\/\/hosting-marketers.com\/news\/category\/security\/"},"img":{"alt_text":"Laravel security is not optional \u2014 and at Hosting Marketers, we make sure you start with the best protection possible. By combining strong server-level firewalls with smart application-level hardening, your Laravel website can stay one step ahead of hackers.","src":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_15_08-AM.png?fit=800%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_15_08-AM.png?fit=800%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_15_08-AM.png?fit=800%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_15_08-AM.png?fit=800%2C1200&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":551,"url":"https:\/\/hosting-marketers.com\/news\/2015\/12\/10\/a-few-steps-to-protect-your-wordpress-from-hackers\/","url_meta":{"origin":1353,"position":1},"title":"a few steps to protect your wordpress from hackers","author":"Admin","date":"December 10, 2015","format":false,"excerpt":"1- Stay UPDATED \u00e2\u20ac\u201c Run the latest version of WordPress, and upgrade your plugins and themes as quick as possible. 2- Have a strong password. 3- Disable PHP Execution in Certain WordPress Directories \u00e2\u20ac\u201c This disables PHP execution in the upload directories and other directories of your choice. Basically so\u2026","rel":"","context":"In &quot;worpress security&quot;","block_context":{"text":"worpress security","link":"https:\/\/hosting-marketers.com\/news\/category\/worpress-security\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1371,"url":"https:\/\/hosting-marketers.com\/news\/2025\/04\/15\/the-ultimate-wordpress-security-guide-for-cpanel-users-2025-edition\/","url_meta":{"origin":1353,"position":2},"title":"The Ultimate WordPress Security Guide for cPanel Users (2025 Edition)","author":"Admin","date":"April 15, 2025","format":false,"excerpt":"WordPress powers over 40% of all websites \u2014 which makes it a prime target for hackers. If you\u2019re hosting with cPanel and using WordPress, security should be your top priority. At Hosting Marketers, we give you the tools (LiteSpeed, CloudLinux, CPGuard, Cloudflare) \u2014 but here\u2019s what you need to do\u2026","rel":"","context":"In &quot;security&quot;","block_context":{"text":"security","link":"https:\/\/hosting-marketers.com\/news\/category\/security\/"},"img":{"alt_text":"Protect your WordPress site from hackers with this complete security guide. Learn how to harden your site using cPanel, PHP updates, file permissions, .htaccess rules, and best practices.","src":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_36_03-AM.png?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_36_03-AM.png?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_36_03-AM.png?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_36_03-AM.png?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hosting-marketers.com\/news\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-15-2025-06_36_03-AM.png?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":429,"url":"https:\/\/hosting-marketers.com\/news\/2013\/12\/18\/time-zone-how-to-change-it-on-shared-cpanel-servers\/","url_meta":{"origin":1353,"position":3},"title":"Time Zone, how to change it on shared cpanel servers","author":"Admin","date":"December 18, 2013","format":false,"excerpt":"You cannot change it, not on a shared server, but it is possible to change it for your account by editing the PHP script or adding a line to the .htaccess file. You can change the time zone being displayed with a PHP script. (Unfortunately, I cannot tell you where\u2026","rel":"","context":"In &quot;php time zones&quot;","block_context":{"text":"php time zones","link":"https:\/\/hosting-marketers.com\/news\/category\/php-time-zones\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":138,"url":"https:\/\/hosting-marketers.com\/news\/2009\/11\/19\/register_globals-on-servers-with-suexec\/","url_meta":{"origin":1353,"position":4},"title":"register_globals on servers with SuExec","author":"Admin","date":"November 19, 2009","format":false,"excerpt":"First of all allowing register_globals on, on a server is real stupid, it is a security risk that no hosting company should accept, but sometimes for old scripts it is necessary to have it on, in this case should be enabled on the customer account on the .htaccess file or\u2026","rel":"","context":"In &quot;Hosting Marketers News&quot;","block_context":{"text":"Hosting Marketers News","link":"https:\/\/hosting-marketers.com\/news\/category\/hosting-marketers-news\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":184,"url":"https:\/\/hosting-marketers.com\/news\/2010\/11\/02\/what-to-do-when-your-site-is-hacked-or-when-you-arrive-at-your-site-you-this-warning-reported-attack-page\/","url_meta":{"origin":1353,"position":5},"title":"what to do when your site is hacked or when you arrive at your site you see this warning: Reported Attack Page!","author":"Admin","date":"November 2, 2010","format":false,"excerpt":"What to look for The three most common forms of badware that StopBadware sees on compromised sites are: 1. Malicious scripts 2. .htaccess redirects 3. Hidden iframes Malicious scripts Malicious scripts are often used to redirect site visitors to a different website and\/or load badware from another source. These scripts\u2026","rel":"","context":"In &quot;Reported Attack Page!&quot;","block_context":{"text":"Reported Attack Page!","link":"https:\/\/hosting-marketers.com\/news\/category\/reported-attack-page\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts\/1353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/comments?post=1353"}],"version-history":[{"count":6,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts\/1353\/revisions"}],"predecessor-version":[{"id":1365,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/posts\/1353\/revisions\/1365"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/media\/1354"}],"wp:attachment":[{"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/media?parent=1353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/categories?post=1353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hosting-marketers.com\/news\/wp-json\/wp\/v2\/tags?post=1353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}