I have WordPress installed to one of my subfolders. I also have subfolder with a folder inside containing index.html inside the WordPress folder.

Now, I'm redirecting all www to non-www URLs using this .htaccess code:

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

this works properly on my root and WordPress folder, but the subfolder with index.html inside WordPress doesn't redirect to non-www. the WordPress is also working fine and redirecting all of it's pages to non-www.

what could possibly be the problem? sorry I'm new to .htaccess.

here's the structure:

- index.html
- subfolder1
  - wp-admin
  - wp-content
  - wp-includes
  - wordpress-files.php (local files of wordpress)
  - ma
    - profile
      - 01
        - index.html
- subfolder2
  - index.html
- subfolder3
  - index.html

the reason I made this structure is because I want the url to look like domain.com/subfolder1/profile/01/

thank you in advance.

  • Why do you NOT want to use www? This closes the door on using a CNAME for your site. NEVER use a 301 redirect until your config is tested and working.
    – symcbean
    Commented Jan 12 at 10:38
  • Please include your complete .htaccess file(s) (with your redirect rule in place). What other .htaccess files do you have? I assume the .htaccess file you've posted is in the root and I would think you have another .htaccess file in the "wordpress" subdirectory (/subfolder1)? Anything else?
    – MrWhite
    Commented Jan 12 at 13:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.