Artifacts upon loading without www - subdomain

I've recently came across a problem with-in our website, We are using a sub-domain for the main domain & have came across a problem with our theme. Some light would be super helpful as i'm running out of options!
The problem is simply when i use our website by typing the following address - www.ecigone.co.uk
I receive no error's, But When i use the web address without the www. i receive artifact's instead of icon's. Especially in firefox.
I have tried a range of fixe's including re-direct's which have seemed to give no joy.

Thank's to Showdev for posting the link,
For anyone wondering & haven't found the answer, i used this code below.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
It Simply redirect's non www. to www, Hope this helps. Happy web developing!

Related

Only the homepage redirects to www version and not the internal pages. Why?

I am trying to redirect all the requests to https www version of the website. Homepage redirects perfectly fine but any other page of the website doesn't. I checked the redirect rules mentioned in the htaccess and they work perfectly fine. However, on the live website, it doesnt.
Here's the redirect rules
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301,NC]
Any reason why this is happening?
I tried working through different redirect rules to see which one redirects as per the requirement.
try this
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.yourSiteName.com/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.yourSiteName.com/$1 [L,R=301]

.htaccess: remove .html and redirect slash version

On my site, all pages have .html extension and are directly off the root (i.e., site.com/page.html). I've successfully used the following .htaccess code to make .html not show:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
This gives me a url like site.com/page, but in the event that a user links to or visits the url using a slash (i.e., site.com/page/), I'd like to 301 redirect to the non-slash version.
I'm having trouble integrating this part into the above code. Thanks in advance for any suggestions.
Try to something like this
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.example.com/$1/ [L,R=301]

Force Trailing Slash + Remove .html and website keeps loading error

I am having problem with adding trailing slash end of URL. I have tried many suggestions from overall web but came up with no successful outcome. Hiding .html works fine, however adding slash does not really work. Main issue is that after I apply code below, the slash appears but website or any page gets never loaded. It keeps in loading mode. I would appreciate if someone helps me through.
My code in .htaccess is:
ErrorDocument 404 /thanks.html
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^([^/]+)/$ $1.html
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.]+\.html(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.html$ http://%{HTTP_HOST}/$1 [R=301,L]

How to make .html appear as / in .htaccess

My problem is this,
I want for example:
Make www.mywebsite.com/index.html
Look/appear (not redirect) like this
www.mywebsite.com/index/
so far I used below code and only obtained www.mywebsite.com/index look.
I will highlight that I don’t want to redirect, I want only to the html look like folder
I work in Adobe MUSE. I build websites mostly for fun and just want to focus on designing not coding
Here is my .htaccess script taken from here: .htaccess rewrite /foo/bar/ to /foo/bar.php
Please, can someone help me with it?
What line(s) should I change to have the folder appearance
Thanks
Options -MultiViews
RewriteEngine On
RewriteBase /
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Za-z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.html -f
RewriteRule ^(.+?)/?$ $1.html [L]

how do i use .htaccess to redirect different languages to different pages?

I'm trying to make a simple 2-language site, en and th, I am unfamiliar with .htaccess but found an online tool: http://www.htaccesstools.com/redirection-by-language/
I would like English browsers to go to my root folder's index.html, and Thai browsers to a subfolder.
What I got from the generator is:
RewriteEngine on
RewriteCond %{HTTP:Accept-Language} th [NC]
RewriteRule .* http://www.mysite.com/th/index.html [R,L]
This doesn't work and I get a redirect loop/other error. I've tried changing the url on the last line to be relative, but this doesn't affect it.
Any help?
*to confirm, i have one .htaccess in my root folder only
Try this in your .htaccess file:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_URI} !^(/th/index.html|.*\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt))$ [NC]
RewriteCond %{HTTP:Accept-Language} ^th [NC]
RewriteRule .* /th/index.html [R,L,QSA,NE]