How can url be rewritten via htaccess?

  • 0
    Hello, is it possible to rewrite the url from site.ru/dop_pages/aerial-survey/index.html to site.ru/aerial-survey/ while staying on the same page through the htaccess file
    htaccess Olivia Martin, May 31, 2020

  • 1 Answers
  • 0
    RewriteCond %{THE_REQUEST} " /dop_pages/([^?]+)/index\.html"
    RewriteRule ^ /%1/ [R=301,L,NE]

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

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!