R
R
Rostislav2017-02-21 13:49:35
Apache HTTP Server
Rostislav, 2017-02-21 13:49:35

How to give a file with an extension using htaccess, and display it in the URL without an extension?

There is a site on pure html.
All articles are in the root of the site, and the categories are in folders.

site.com - папка категории - index.html (то есть страница категории)

Accordingly, a link to the category page
site.com/category/index.html
How to make the url be site.com/category , but at the same time the site.com/category/index.html page is given?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
display: block, 2017-02-21
@qork

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.html [L]

I
Ivan, 2017-04-29
@bordakovskiy

display: block Created a file with your content, and something doesn't work very well. .html changed to .php
at the root there is a style fam.css
news news.php
if I access site/fam then styles open, and if site/news then 404. Having added the extension, everything is fine. what am I doing wrong?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question