Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php www to non www redirect

$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

if (preg_match('/www./', $url)){

  $url = str_replace('www.','https://', $url);

  header( "HTTP/1.1 301 Moved Permanently" );
  header( 'Location: ' . $url );
  exit;
}
Comment

PREVIOUS NEXT
Code Example
Php :: Laravel Excel numbers formatted as text still appearing as number 
Php :: laravel migration table column nullable 
Php :: laravel 6 orderby 
Php :: laravel server sent events 
Php :: Allowed memory size of 1610612736 bytes exhausted 4096 
Php :: how to completely delete php 
Php :: laravel blade shorthand if 
Php :: how to get event dates on change in datetimepicker with laravel livewire 
Php :: laravel passport get tokenId 
Php :: laravel add attribute to model 
Php :: php to lowercase 
Php :: laravel create model and migration 
Php :: php artisan test 
Php :: htmlspecialchars_decode (PHP 5 = 5.1.0, PHP 7, PHP 8) htmlspecialchars_decode — Convert special HTML entities back to characters 
Php :: laravel validation digits 
Php :: php mysql prepare query 
Php :: layout.blade.php in laravel 
Php :: php get this week date range 
Php :: model get last query in php 
Php :: features of PHP7 
Php :: settimezone in php 
Php :: using PDO and PHP = Login.php 
Php :: or where in codeigniter 
Php :: how to check user already exists in php 
Php :: symfony get path to route 
Php :: laravel hasMany with join 
Php :: type casting in php 
Php :: SPA and keep some of the Laravel pages you need to have a route like this 
Php :: get post info in php 
Php :: how to set time ago in php 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =