Two “.htaccess” Files Located in Different Directories?

I found two “.htaccess” files, one is located in ‘/httpdocs/.htaccess’, another one is located in ‘/httpdocs/wordpress/.htaccess’, the content is different, is it normal?

The WordPress was installed on ‘/wordpress/’ dir, then never changed, but when users go to my site, the URL shows “http://www.mydomain.com”, no ‘wordpress’ shown on the URL.

Also, from Settings > General:

WordPress Address (URL): http://www.mydomain.com/wordpress

Site Address (URL): http://www.mydomain.com

2 Answers
2

In general, Apache will use the most specific .htaccess to the resource being requested. This means that, for accessing files in /httpdocs/wordpress/, /httpdocs/wordpress/.htaccess will be used. Access to /httpdocs/foo/ will use /httpdocs/foo/.htaccess and, if that doesn’t exist, it will use /httpdocs/.htaccess.

If your document root is pointing to /httpdocs/wordpress/, then users will see http://www.example.com as your WordPress directory. Also, if your /httpdocs/.htaccess includes rewriting to hide the wordpress in your folder name, the same will happen.

Leave a Comment