April 29, 20215 yr Hi all, I have 2 pieces to my htaccess that seem to have conflicting interests. The first block is what I have added as the site is built with Vue and the tutorial suggested this. The second is from my old site and forwards requests without 'www' to the address with 'www'. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] RewriteCond %{HTTP_HOST} ^address.co.uk [NC] RewriteRule ^(.*)$ http://www.address.co.uk/$1 [L,R=301,NC] </IfModule> The non 'www' url forwards correctly when on the homepage, but if someone directly accesses a sub page without adding 'www' it simply just stalls on loading. Is this easy to overcome? At worst I will the second part for the time being, but would be great to know if there is a simple solution to this. Thanks
May 4, 20215 yr Hi Red, This should fix the non-www to www; RewriteCond %{HTTP_HOST} !^www\.address\.co\.uk [NC] RewriteRule (.*) http://www.address.co.uk%{REQUEST_URI} [L,R=301] ... this says if the http_host is not www.address.co.uk then to forward to the www version with a permanent 301.
Create an account or sign in to comment