
Redirect from www to non www in laravel using htaccess
Redirect from www to non www in laravel using htaccess
In this session, we’ll try our hand at solving the "Redirect from www to non www in laravel using htaccess" puzzle by using the computer language.
You can redirect from www to non www in laravel using htaccess. Htaccess will redirect you from https://www.yourdomain.com/ to https://yourdomain.com/ using RewriteCond %{HTTP_HOST} www.yourdomain.com RewriteRule (.*) http://yourdomain.com/$1 [R=301,L] in your htaccess file.-
Redirect from www to non www using htaccess file in laravel 8
--PATH .htaccess<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{HTTP_HOST} www.yourdomain.com RewriteRule (.*) http://yourdomain.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>
You have to add the below code in your htaccess file
RewriteCond %{HTTP_HOST} www.yourdomain.com
RewriteRule (.*) http://yourdomain.com/$1 [R=301,L]Replace with your domain name in above code.
This code snippet is working in my case.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- How to get IP address in laravel
- Create project factory and seed data in laravel
- Get ids in array from users table
- Print last executed query in laravel
- Link storage folder in laravel 8
- How to check relationship is loaded or not in Laravel
- How to restore deleted records in laravel
- How to get the random value form a specific column in laravel ?
- SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key
- How to return error message from controller to view in laravel
- Display option of select as selected with blade directive Laravel
- JQuery each loop on json response after ajax in laravel
- Delete file from amazon s3 bucket using Laravel
- How to remove P tag from CkEditor in Laravel?
- How to add active class to menu item in laravel
- Split an Eloquent Collection by half in Laravel
- Retrieve count of nested relationship data in Laravel
- Display data in table using foreach in Laravel
- Get last record from table in laravel
- How to pass data to partial view file in laravel
- Create record with unique slug in laravel
- Target class [admin] does not exist.
- Laravel get all records with pagination
- How to disable timestamps in laravel
- Laravel save object to database