1

I have a sub-directory named CMS {example.com/cms}. I need to redirect it to example.com/blog and mask that with the name blog. While doing this example.com/cms/page1 should also redirect and mask with example.com/blog/page1. I need .htaccess code that do this. I have tried all codes available, nothing works.

the code i tried was

RewriteRule ^blog/(.+)$ /cms/$1 [L,NC]

SO-user
  • 1,458
  • 2
  • 21
  • 43

1 Answers1

0

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On
RewriteBase /

RewriteRule ^cms(/.*)?$ blog$1 [L,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643