D
D
Dmitry2021-02-03 14:00:37
htaccess
Dmitry, 2021-02-03 14:00:37

How to shorten links using .htaccess?

There are links like https://site.co.ua/projekts/abc/page.html , https://site.co.ua/projekts/def/page.html and so on. You need to change their display to https:/ /site.co.ua/abc https://site.co.ua/def and so on.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-02-03
@apptwo

RewriteEngine on

RewriteCond %{THE_REQUEST} " /projekts/([^/]+)/page\.html" 
RewriteRule ^  https://site.co.ua/%1 [R=301,L]

RewriteCond %{DOCUMENT_ROOT}/projekts/$1/page.html -f
RewriteRule ^([^/]+)$  /projekts/$1/page.html [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question