Post by brinsteve » Thu Mar 28, 2024 6:13 am

There is a problem with www. I searched on various forums and everywhere they say that I should direct non www to www. But in my case www does not work. At this moment the site works without www. With www, only certain links similar to the sitemap appear.

I had to redirect from cpanel www to non www, and everything works fine, with one exception: don't click on www.

Example: it works perfectly with https://elegantmarket.ro
and it no longer works correctly if I access www.elegantmarket.ro directly

.httaccess is configured like this:
RewriteEngine on

Inherited RewriteOptions

# php -- BEGIN cPanel-generated handler, do not edit
# Set the "ea-php80" package as the default "PHP" programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^www\.elegantmarket\.ro$ "https\:\/\/elegantmarket\.ro\/" [R=301,L]

Does anyone have an idea what should be done to make it work correctly with www?
(if necessary, the version used is 3.0.3.9)

Thank you in advance based on your professionalism and goodwill.

Newbie

Posts

Joined
Mon Oct 23, 2023 4:59 pm

Post by ADD Creative » Thu Mar 28, 2024 8:28 am

Something like the following should work.

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
Last edited by ADD Creative on Fri Mar 29, 2024 6:36 am, edited 1 time in total.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by SohBH » Thu Mar 28, 2024 3:03 pm

It shows header blocking the stylesheet request.

View all extensions | Request custom work | Pricing | Contact Me


User avatar
Active Member

Posts

Joined
Mon Nov 02, 2020 12:01 am
Location - Malaysia

User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by brinsteve » Fri Mar 29, 2024 4:45 am

ADD Creative wrote:
Thu Mar 28, 2024 8:28 am
Something like the following should work.

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ https://.example.com/$1 [R=301,L]
Thanks, it works perfectly with this code. Although an error appears in your code and I received a message that the domain to which it was redirected was not on the server. I checked and noticed that there was an extra point. After I removed it, the code turned out to be perfect. For other people who will face the same problem, I leave the repaired and functional code below.

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
For those who want to check the functionality, I leave the links here:
www.elegantmarket.ro
https://www.elegantmarket.ro
http://www.elegantmarket.ro
https://elegantmarket.ro
http://elegantmarket.ro
Last edited by brinsteve on Fri Mar 29, 2024 5:06 am, edited 2 times in total.

Newbie

Posts

Joined
Mon Oct 23, 2023 4:59 pm

Post by brinsteve » Fri Mar 29, 2024 5:04 am

SohBH wrote:
Thu Mar 28, 2024 3:03 pm
It shows header blocking the stylesheet request.
Meaning? Can you explain please?

Newbie

Posts

Joined
Mon Oct 23, 2023 4:59 pm

Post by ADD Creative » Fri Mar 29, 2024 6:37 am

brinsteve wrote:
Fri Mar 29, 2024 4:45 am
Thanks, it works perfectly with this code. Although an error appears in your code and I received a message that the domain to which it was redirected was not on the server. I checked and noticed that there was an extra point. After I removed it, the code turned out to be perfect. For other people who will face the same problem, I leave the repaired and functional code below.

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
For those who want to check the functionality, I leave the links here:
www.elegantmarket.ro
https://www.elegantmarket.ro
http://www.elegantmarket.ro
https://elegantmarket.ro
http://elegantmarket.ro
Yes, sorry I left the extra . in there by mistake.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 20 guests