Это содержимое моего файла .htaccess:
php_flag allow_url_fopen on
DirectoryIndex index.php
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|php|js)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A86400
ExpiresByType image/png A2419200
ExpiresByType image/jpg A2419200
ExpiresByType image/jpeg A2419200
</IfModule>
AuthName domain.com
ErrorDocument 404 /404.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com.ar/$1 [R=301,L]
RewriteRule index.html$ Controlador/index.php [L]
</IfModule>
AddHandler php5-script .php
Я хочу, чтобы index.html (которого не существует) был перенаправлен на мой контроллер. index.php (который существует) должен быть моей домашней страницей.
Теперь моя домашняя страница не работает при наборе текста http://www.domain.com/ в моем браузере. Этот URL-адрес перенаправляет на мой контроллер. http://www.domain.com/index.php работает нормально, принося мою домашнюю страницу.
Как установить index.php в качестве индексного файла, сохраняя перенаправление для контроллера?
Вы можете попробовать:
Options +FollowSymLinks
RewriteEngine on
Redirect 301 /index.html http://www.domain.com.ar/Controlador/index.php
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com.ar/$1 [R=301,L]