How to change default directory with .htaccess or?

Hello,

I am looking for some assistance on a project i was given related to the .htaccess file.

I have a web site where the root or “public_html” directory contains 2 folders of note. One folder is named web and the other is named blog. Each folder has content I want people use.

Right now if someone logs into the root or “http://mysite.com” they get a directory listing.
I was able to stop the listing using the IndexIgnore * command.

If they log into “http://mysite.com/web” they get the web site home page and load the default document. This is fine.
If they log into “http://mysite.com/blog” they get the blog site home page and load the default document.This is fine.

My goal is when someone logs into http://mysite.com I want their browser to go to the /web folder and load the default document.

I’ve been messing with some of the RewriteCond commands I’ve come across but have not been able to figure it out.

Can someone kindly provide a reference on how to do this?

Thank you!!

JesseR

Hi Jesse,

The proper directive to turn off the display of directory contents isOptions -IndexesThat is a core directive.

Normally, you use the DocumentRoot for … a welcome page? IMHO, you should use a welcome page adding links to your website and your blog site. Personally, I’d go one step farther and use the blog directory as the DocumentRoot for the blog subdomain, i.e., blog.example.com, because that will skip over the example.com’s DocumentRoot. It would also allow me to use the website’s DocumentRoot by moving the web subdirectory’s contents there.

No matter, that was not your request so, presumably, the $$$ behind your task is adamant about doing things in the (weird) requested manner, i.e., using .htaccess in the DocumentRoot to redirect domain requests to the web subdirectory.RewriteCond ^$ web/ [R=301,L]

Regards,

DK

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.