I
I
Ivan Ivanov2017-10-07 10:44:55
Kohana
Ivan Ivanov, 2017-10-07 10:44:55

How to redirect all pages from http to https except robots.txt on kohana framework using .htaccess?

The site is written in kohana. Tried different options, but none of them worked.
robots.txt is generated through the controller, there is no physical robots.txt file, so this directive probably
RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC]
does not work.
Now the content of .htaccess is:

# Turn on URL rewriting
RewriteEngine On

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [QSA,R=301,L] 



# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
  Order Deny,Allow
  Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php [L]

Accordingly, an unwanted redirect occurs from site.ru/robots.txt to https://site.ru/robots.txt . How to avoid it? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question