Raden Octavian
Raden Octavian

Reputation: 27

Set subfolder as index website

i am developing new website with 2 language (English & Indonesian) with bootstrap, PHP and MySQL. i put english website files in "en" folder and indonesian website files in "in" folder. I want to set the default page of my website to /in . so when i access my website www.mydomainname.com it will automatically redirected to www.mydomainname.com/in . How do i do this? maybe you guys could help. Thanks a lot

Here is my website folders look a like :

/mydomainname
/mydomainname/in
/mydomainname/en

Upvotes: 1

Views: 55

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

You can use DirectroryIndex directive in .htaccess

DirectoryIndex en

This will rewrite http://example.com/ to example.com/en without changing the url.

You can also use RedirectMatch to redirect your homepage / to the /en . changing your browser url from / to /en .

RedirectMatch ^/$ /en

References :

DirectoryIndex (mod-dir)

https://httpd.apache.org/docs/2.4/mod/mod_dir.html

RedirectMatch (mod-alias)

https://httpd.apache.org/docs/2.4/mod/mod_alias.html

Upvotes: 1

Related Questions