
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 check query string exists or not in laravel blade
- Get current month records in laravel 7/8
- In order to use the Auth::routes() method, please install the laravel/ui package
- Laravel get single row by id
- How to send email in laravel
- How to get CSRF token in laravel controller
- Update last created record in Laravel
- How to restore deleted records in laravel
- Count all and get 10 records after where condition in laravel
- Get today records in Laravel
- Touch parent updated_at in Laravel
- Symlink(): No such file or directory
- Declaration of App\Models\Post::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable
- File_put_contents(/var/www/html/w3code/storage/framework/sessions/CXwN3EXKxERD6jgy3rADcaAAbAx8FRKih2JK7UO9): Failed to open stream: Permission denied
- How to add is_activated column in database using laravel migration
- How to Get records between two dates in Laravel
- Permission denied error while creating storage link in Laravel
- Insert data with form validation using ajax in laravel
- Composer\Exception\NoSslException
- Update email with unique validation in laravel
- How to upload image in laravel 8
- How to return error message from controller to view in laravel
- How to get column names from table in Laravel
- Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() must be of the type string or null, object given
- Laravel 9 pagination with search filter