mercredi 23 septembre 2020

i want to redirect any url to www

Hi i have problem with i want to redirect any website to be https://www.something.com/en/ i did that but if anyone write https://something.com/en/ it's not redirecting to https://www.something.com/en/ i need to redirect any one if write https://something.com/en/ to https://www.something/en/ .

my apache conf file :

<VirtualHost *:80>
      ServerName something.com
      ServerAlias www.something.com
      DocumentRoot /var/www/html/something.com/public
      Redirect permanent / https://www.something.com

</VirtualHost>

.htaccess file :

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

and i tried this too :

RewriteEngine On
RewriteCond %{HTTP_HOST} *.something.com [NC]
RewriteRule ^(.*)$ https://www.something.com/$1 [L,R=301]



Aucun commentaire:

Enregistrer un commentaire