1

I have an .htaccess file in my root directory with the following contents:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://website.com/$1 [R=301,L]
DirectoryIndex index.php
Options -Indexes

Works perfect in the root.

The problem is with subfolders. If I manually go to: http://www.website.com/myfolder it pushes me to: https://website.com/myfolder/.php (404 error)

My goal is to always remove the "www" and redirect to SSL for the root and all subfolders. Obviously without the above error where it somehow leaves the ".php"

Please help!

Thanks!

  • That's three different things right there. The RewriteCond you have only makes sense for matching non-SSL requests. This rule makes no sense to for stripping "www". And the stray `.php` more likely stems from another (copynpasted) rule in the subdirectory. Show RewriteLog and curl header debugging. (Also nobody here is fond of the obnoxious "please help" and "thanks" with every question.) – mario Nov 17 '17 at 00:15
  • Sorry - didn't know please and help was obnoxious – ShorePatrol Nov 17 '17 at 01:20
  • Also, I don't know how to show the rewritelog, or curl header. Obviously I'm not expert, which is why I'm here. Was just hoping for the code that would accomplish my "goals" above. – ShorePatrol Nov 17 '17 at 01:32

0 Answers0