V
V
vladislav9972020-03-04 11:02:13
htaccess
vladislav997, 2020-03-04 11:02:13

How to remove directory name from URL?

Tell me , there is a url like:
www.site.com/pages/... , where "..." are the names of the pages. How to remove /pages /

from the url via htaccess and make links like: www.site.com/... , but the pages will be in pages

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-03-04
@vladislav997

RewriteEngine on

RewriteCond %{THE_REQUEST} " /pages(/\S*)"
RewriteRule ^ %1 [R=301,L]

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question