The provided code in the question is already doing what the user wants. It redirects HTTP to HTTPS, removes the public folder from the URL, and serves the Google file verification or other files with their correct headers.
Apr 18, 2023
4
Level 10
.htaccess
I want to go to public/index.php with this code. I want to read .txt and .html, and I want to https
RewriteEngine on
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Rewrite requests to /public to the index.php file inside the /public directory
# Remove public folder form URL
RewriteRule ^(.*)$ public/ [L]
# Serve the Google file verification or other files with their correct headers
<FilesMatch "^(google[a-f0-9]{16}\.html|.*\.txt)$">
Header set Content-Type "text/plain"
</FilesMatch>
Please or to participate in this conversation.