Вопрос по переадресации

V2
На сайте с 05.01.2012
Offline
120
336

Есть сайт, site.ru, внутри каталог aaa, в котором находится файл index.html

Когда я захожу на этот файл http://site.ru/aaa/index.html

он в браузере открывается по адресу http://site.ru/aaa/, а нужно, чтобы он открывался

по адресу http://site.ru/aaa, (без слеша в конце)

Точнее нужно, чтобы адрес http://site.ru/aaa открывался без редиректа

на http://site.ru/aaa/, а страница http://site.ru/aaa/index.html

показывалась по тому адресу, по которому на неё заходят.

закидываю в корень сайта .htaccess файл с содержимым

Redirect 301 /aaa/ http://site.ru/aaa

получается замкнутый цикл

Firefox определил, что сервер перенаправляет запрос на этот адрес таким образом, что он никогда не завершится.

как правильно это сделать?

J
На сайте с 20.02.2014
Offline
120
jkm
#1


RewriteEngine On

RewriteRule ^aaa$ /aaa/index.html [L]

DirectorySlash Off
V2
На сайте с 05.01.2012
Offline
120
#2

jkm, с такой штукой

RewriteEngine On

RewriteRule ^aaa$ /aaa/index.html [L]

DirectorySlash Off

по адресу http://site.ru/aaa я вижу содержимое каталога aaa, все файлы которые в нем находятся, выходит индексный файл игнорируется.

По адресу http://site.ru/aaa/ все как обычно, без изменений.

Samail
На сайте с 10.05.2007
Offline
369
#3
Vitaly2012:
по адресу http://site.ru/aaa я вижу содержимое каталога aaa, все файлы которые в нем находятся, выходит индексный файл игнорируется.
Turning off the trailing slash redirect may result in an information disclosure. Consider a situation where mod_autoindex is active (Options +Indexes) and DirectoryIndex is set to a valid resource (say, index.html) and there's no other special handler defined for that URL. In this case a request with a trailing slash would show the index.html file. But a request without trailing slash would list the directory contents.

http://httpd.apache.org/docs/2.2/mod/mod_dir.html

V2
На сайте с 05.01.2012
Offline
120
#4
Turning off the trailing slash redirect may result in an information disclosure. Consider a situation where mod_autoindex is active (Options +Indexes) and DirectoryIndex is set to a valid resource (say, index.html) and there's no other special handler defined for that URL. In this case a request with a trailing slash would show the index.html file. But a request without trailing slash would list the directory contents.

Это по поводу этой строчки, как я понял ?

DirectorySlash Off

Если её убрать, то http://site.ru/aaa редиректит на http://site.ru/aaa/, вобщем тоже что и было.

А нужно чтобы и http://site.ru/aaa и http://site.ru/aaa/ открывали файл index.html который находится в папке aaa

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий