Issue with htaccess file

Hello!!

I am creating a new web site with submenu with the last MODx.
I created other web sites with MODx, some years ago and I am used to use Friendly URL and htaccess file.

I observed a small differences in the ht.access file.

As I am using Friendly URL, I keep those lines

# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Then I moved up I checked thoss lines

RewriteEngine On
RewriteBase /

Finally , I move a bit down until the following

# Rewrite www.example.com -> example.com -- used with SEO Strict URLs plugin
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
#RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
#
# or for the opposite example.com -> www.example.com use the following
# DO NOT USE BOTH
#
#RewriteCond %{HTTP_HOST} !^$
#RewriteCond %{HTTP_HOST} !^www\.espace-awen\.ch [NC]
#RewriteCond %{HTTP_HOST} (.+)$
#RewriteRule ^(.*)$ https://www.espace-awen.ch/$1 [R=301,L] .

I checked the configuration (of rhe previous web site) and I observed, I used the fist option, but my previous config do not have %1 and https

I tried the following:

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www.espace-awen\.ch [NC]
RewriteRule (.*) https://www.espace-awen.ch/$1 [R=301,L]

Look here https://www.espace-awen.ch/

Something is going wrong because if you go on the home page and you move the mouse over “Séance individuelle” (without clicking), you can see
(ignore the spaces before the first w and the :slight_smile:

https :// www.espace-awen.ch/seance-awen/

if now you click and you move the move again over “Séance Individuelle” you can see

https :// www.espace-awen.ch/seance-awen/seance-awen/

There is a repetation.

If from now you click another link and we see

https :// www.espace-awen.ch/seance-awen/seance-awen/leutonie-g.a.html

and that’s not possible, you should read

https :// www.espace-awen.ch/leutonie-g.a.html

I may have something wrong in my htaccess file, may be \ before a dot

Some idea where is my mistake?
Many thanks

OK, apparently my problem was solbe by adding

<base href="[[!++site_url]]">

In my template.

But I am not sure if I correctly configured my htaccess file.
Any suggestion would be nice

In my experience you don’t have to write any custom code in the .htaccess file. You can simply outcomment the desired function, so if you want to always display the www in front of your domain, then this should work:

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} (.+)$
RewriteRule ^(.*)$ https://www.%1/$1 [R=301,L] .