Help with htaccess

I need help with my .htaccess

That is what I see in it currently:

RewriteOptions inherit
RewriteEngine On

RewriteRule ^.*-p[\d]+$ %{REQUEST_URI}/../index.html
RewriteRule ^.*-c[\d]+$ %{REQUEST_URI}/../index.html
RewriteRule ^.*cart$ %{REQUEST_URI}/../index.html
RewriteRule ^.*search.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*checkout/.+$ %{REQUEST_URI}/../index.html
RewriteRule ^.*account/.+$ %{REQUEST_URI}/../index.html
RewriteRule ^.*pages/.+$ %{REQUEST_URI}/../index.html
RewriteRule ^.*signIn.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*resetPassword.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*checkoutAB.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*downloadError.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*checkoutResult.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*checkoutWait.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*orderFailure.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*checkoutCC.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*checkoutEC.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*checkoutAC.*$ %{REQUEST_URI}/../index.html
RewriteRule ^.*FBAutofillCheckout.*$ %{REQUEST_URI}/../index.html

RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteCond %{HTTP_HOST} ^www.frenchlinensonline.com$
RewriteRule ^/?$ “https://www.frenchlinensonline.com/” [R=301,L]

I need FORCE HTTPS and WWW
I see code to do it here: Some generic htaccess redirects

Code recommended is this:

Force HTTPS and force WWW:

#  Force HTTPS and force WWW (this is a comment)
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]

What do I do?
Do I erase everything that is already in place and replace with the code recommended?
Do I add the code recommended and keep in place what is already there?
Or something else?

And should I remove/change a file that is on my server now, or will this one (inside my rapid weaver project) overwrite what is on the server?

Thank you in advance
Natasha

Here is my htaccess file that works fine for me to force https

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

and here’s the lines for force www:

RewriteCond %{HTTP_HOST} ^example.com [NC]

RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301,NC]

Do you have any idea of what you were trying to do with all those RewriteRule's?

They’re kinda strange looking to me, for example:
RewriteRule ^.*cart$ %{REQUEST_URI}/../index.html
Will take any URL’s that end with “cart” and add an empty directory /../ and index.html.

So this url
https://example.com/anypage/cart
would get redirected to
https://example.com/anypage/cart//index.html

That’s technically an invalid URL as you can’t have an empty directory although browsers will ignore the empty directory.

So without knowing everything you want or wanted to do it’s hard to say what exactly to do.

You can only have one .htaccess file in a single directory. You can have multiple .htaccess files on a site, one per directory (folder). The directives are applied to the directory they are in and any child directory.

The RapidWeaver htaccess editor only reads and writes the htaccess file in the root directory (where the publishing path points). This would apply to the entire site.

  • So where(what directory) did you find this .htaccess file you are showing the snippets from?
  • Was it named dot htaccess (.htaccess)?
  • Do you have any idea where those directives came from and what they are supposed to do?

The generic code above works like a champ to force www and https, and does it in a single rewrite rule(pretty efficient) without changing a thing.

If that’s all you want to do then I’d probably rename the old htaccess file and replace it.

Hello Doug!

Thank you for quick answer!

The code that I’m showing is in Rapidweaver (publish edit).
Those lines refer to the ecommerce (Ecwid) that is embedded on the website. Thank you for explaining it all to me, I wasn’t sure if it is the actual code or some sort of a template that I’m supposed to make changes to. Sorry for my ignorance, I actually even didn’t know that file exists! So the code brings the person back to shopping page after the transaction. It was done for me by someone from Ecwid.

I did add the “force https and www” code, it all works now.

My site is this: https://www.frenchlinensonline.com

One more question.
I recall that I’ve read somewhere to put a code in that .htaccess file to allow google AJAX indexing. I’m trying to figure out the reason google is not picking up the micro data from products descriptions.
And also to that same point, stacks pages where Ecwid codes are embedded, should those pages be .html or .php? (For Ajax to work properly)

Thank you for your help!

Sincerely,
Natasha Touchinski

AJAX is short for for "Asynchronous JavaScript and XML” so PHP shouldn’t come into play for that. You might need PHP for something else, most stacks that need PHP will force PHP extension.

I’ve never seen that before, not sure why’d they need something added to htaccess and wouldn’t know what it would be. Google has been using JavaScript rendered code for years. The fact that AJAX uses an XmlDataSource shouldn’t matter.

Why do you think google isn’t reading the descriptions? Have you checked what google has in its cache?

Hello Doug,

I’m not sure what exactly is going on.

I currently have Ecwid installed as an embedded HTML code on Rapid WeaverStacks pages as Default Categories (there are multiple Ecwid Categories displayed on multiple corresponding Rapid Weaver pages).

I encounter some issues with how this setup is showing up in Google Search Results, and I don’t know if it is due solely with the approach of embedding Ecwid store as Default Categories, or if there is something else missing in how I configured it, or in the code I’m using?

Please see files attached that explain all this with more details and screen shots, including Ecwid codes embedded.

My Ecwid ID is. 4212053

Website is https://www.frenchlinensonline.com

Thank you in advance,
Natasha Touchinski

(Attachment Microdata & page descriptions problem.pdf is missing)

(Attachment HTML for tea towel Olivia Multico.pdf is missing)

(Attachment codes inside my rapid weaver file.zip is missing)

(Attachment google search console.zip is missing)

Hi Doug,

I send you an email today, but could not attach some files (PDF). Is there a way?

Natasha

Hi Natasha,

The forum software won’t allow attachments from email and has limits on what you can drag and drop onto the post screen.

You can drag and drop small things like screenshots,but you need to be on browser logged on to the forum.

For larger file sizes it would be best to place theme in a folder and use a file sharing service link Dropbox or Sync and them post a “shareable link” to the folder.

1 Like

Hello Doug,

Thank you for the replay,

I now looks like to me that the bulk of my questions are to be addressed to Ecwid side rather to the Rapid Weaver side.

One more question please regarding .htaccess file

1)How to make a redirect from a page that no longer exist (a product that used to be displayed on it is no longer made), and the page is now deleted from my site, to another page.
2) Page still exist, but was moved inside my site, so the previous URL is no longer valid

Thank you in advance
Natasha

Without knowing the URL’s involved I can’t give you the exact rule, but here are some samples:
same site:

Redirect 301 /path/to/old/file/old.html /path/to/new/file/new.html

REdirect to a differnet site:

Redirect 301 /path/to/old/file/old.html http://www.example.com/new/file/new.html