D
D
Dmitry Volodarsky2017-06-01 17:21:03
HTML
Dmitry Volodarsky, 2017-06-01 17:21:03

How are pages made without ".html" and without "/" at the end and without using root folders?

actually need instead of site. com/mamki.html and instead of site. com/patriarch/ whatever site. com/prnhb

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
pfg21, 2017-06-01
@pfg21

appropriate web server options.
see the documentation for your server. nginx and apache have slightly different implementations.
in general, the names and extensions of the file to the web server to the light bulb, It's
just convenient and clear that *.html is sent directly to the sufferer, and *.php is passed through the php interpreter, but in the general case it is not necessary, you can configure it and vice versa :)

H
huwesu, 2017-06-01
@huwesu

root - "/" and "/index.html" will automatically show the same thing
if it's essential that always only "/" and never "/index.html", then you can, for example, redirect or rewrite.

M
Mark, 2017-06-02
@Mark54

In htaccess do

RewriteEngine on

RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP

RewriteRule ^([^.]+)\.html$ http://www.site.ru/$1 [R=301,L]

RewriteCond %{REQUEST_URI} !(\.[^./]+)$

RewriteCond %{REQUEST_fileNAME} !-d

RewriteCond %{REQUEST_fileNAME} !-f

RewriteRule (.*) /$1.html [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question