R
R
RavenPo2017-06-25 23:25:27
HTML
RavenPo, 2017-06-25 23:25:27

Relative link to index.html not working in child directory?

The link from index.html located in the root of the site to index.html in the child directory does not work. The page loads, but I still stay on the main page of the site, although the links are spelled out correctly. Most likely, you need to somehow properly configure the .htaccess file, but I have already tried many options and nothing helped. I really look forward to your help.
Here is the content of the .htaccess located at the root of the site.
3f396eee9a6b43588844a0f4b848e223.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-06-26
@RavenPo

I see a lot of mistakes, fix them first. 1. the host in www\.comics-man\.ru
is written with a screen of dots, secondly, I would get rid of the domain altogether, and you need to work with https correctly.

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

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

Further easier through REQUEST_URI
RewriteCond %{REQUEST_URI} ^(.*)/index\.html$
RewriteRule ^(.*)$ %1/ [R=301,L]

And what you are doing is just deleting everything.
now with the removal of the slash at the end, in general, semantically, it’s still nuno to put it.
but that's up to you.
in theory it's the other way around.
############################################################################
#### Убираем повторяющиеся слеши (/) в URL                              ####
############################################################################
RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]
############################################################################
#### Убираем слеши в конце URL для статических файлов (содержит точку)  ####
############################################################################
RewriteCond %{REQUEST_URI} \..+$
   # Если файл содержит точку.
RewriteCond %{REQUEST_FILENAME} !-d
   # И это не директория.
RewriteCond %{REQUEST_FILENAME} -f
   # Является файлом.
RewriteCond %{REQUEST_URI} ^(.+)/$
   # И в конце URL есть слеш.
RewriteRule ^(.+)/$ /$1 [R=301,L]
   # Исключить слеш.

############################################################################
#### Добавляем слеш(/), если его нет, и это не файл.                    ####
############################################################################
RewriteCond %{REQUEST_URI} !(.*)/$
   # Если слеша в конце нет.
RewriteCond %{REQUEST_FILENAME} !-f
   # Не является файлом.
RewriteCond %{REQUEST_URI} !\..+$
   # В URL нет точки (файл).
RewriteRule ^(.*)$ $1/ [L,R=301]

Oh, and don't forget Google's recommendations.
<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresByType image/jpeg "access plus 3 day"
  ExpiresByType image/svg "access plus 3 day"
  ExpiresByType image/gif "access plus 3 day"
  ExpiresByType image/png "access plus 3 day"
  ExpiresByType text/javascript "access plus 3 day"
  ExpiresByType text/css "access plus 3 day"
  ExpiresByType application/javascript "access plus 3 day"
</IfModule>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question