Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shahr's avatar
Level 10

How to use .htaccess google.html and txt file

I want to read the Txt file and Html. How do I do it?

And redirect to public/index.php

.htaccess

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>
0 likes
0 replies

Please or to participate in this conversation.