0

I want to redirect all traffic from the root of my website to a subfolder on the same domain using .htaccess

Can someone help me out here?

MrWhite
  • 11,643
  • 4
  • 25
  • 40

2 Answers2

1

Place this in your webroot .htaccesss

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteCond %{REQUEST_URI} !^/subfolder/ 
RewriteRule ^(.*)$ /subfolder/$1 [L]

It checks incoming requests, any to that domain get redirected, unless they are already redirected.

Grizly
  • 2,053
  • 15
  • 20
0

Theres an excellent guide here: mod_rewrite, a beginner’s guide (with examples).

Aaron Tate
  • 1,222
  • 7
  • 9