Htaccess missing www

Here is my .htaccess

AddDefaultCharset UTF-8 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /xcrud RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> 

Everything works fine unless the user skips www as part of the url. Is there an easy way to change this to avoid a loop error of 310? A complete .htaccess example would be a big one, not a 1 liner. THX

+4
source share
1 answer

it solved it. I could not get 301 statuses to work, but this is happening.

 AddDefaultCharset UTF-8 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /demo2 RewriteCond %{HTTP_HOST} ^mathpdq\.com RewriteRule ^(.*)$ http://www.mathpdq.com/demo2/$1 [R=permanent,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> 
+1
source

Source: https://habr.com/ru/post/1445330/


All Articles