Answer the question
In order to leave comments, you need to log in
In mod rewrite what is the correct way to use a subquery?
site in pure html! (burned from the jumulus because the old one and cleaning such sites are already sick of it)
I threw it on a quick .htaccess
RewriteEngine on
RewriteBase /
#убираем инексы как на главнй так и возможные в каталогах.
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} ^(.*)/index\.(html|htm)$
RewriteCond %{REQUEST_METHOD} =GET
RewriteRule ^(.*)$ %1 [NC,L,R]
#удаляем всем остальным
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.html
RewriteRule (.*)\.html$ /$1 [L,R]
#поскольку реально таких урлов нет нужно как-то отработать
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-F
RewriteRule ^([^.]+)$ $1.html [NC,L]
/catalog/.html
Answer the question
In order to leave comments, you need to log in
Usually mod_dir is enabled, which redirects from /catalog
to /catalog/
if it's an existing directory. Those. needed DirectorySlash Off
not to be/catalog/.html
DirectoryIndex index.html
DirectorySlash Off
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^GET\ ([^?]*?)(/index)?\.htm
RewriteRule ^ %1 [L,R,NE]
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^([^.]+)$ $1.html [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question