Nicholas Evm
Nicholas Evm

Reputation: 23

.htaccess redirect to subdirectory without changing url

I have the site

www.site.com

I would like the root directory to read from the /en subdirectory

WITHOUT changing the url to

www.site.com/en on the address bar

Upvotes: 1

Views: 3787

Answers (1)

Ansari
Ansari

Reputation: 8218

Putting this in the .htaccess file in your root directory should do the trick, assuming of course mod_rewrite is installed and enabled, and AllowOverride All is set in the VirtualHost of the conf file. It won't change the address bar.

RewriteEngine On
RewriteRule ^(.*)$ en/$1 [L, NC, QSA]

Upvotes: 1

Related Questions