2

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
  • Hi you already asked this question as a comment on your other question today about .htaccess. You just need to delete one or just leave them there
    – Damien
    Aug 26, 2012 at 16:16
  • But the contents of two files is not the same..
    – RRN
    Aug 26, 2012 at 16:36

2 Answers 2

3

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.

4
  • This is the content from "wordpress/.htaccess", only used by BetterWPSecurity: # BEGIN Better WP Security # Begin HackRepair.com Blacklist RewriteEngine on #Block comment spammers, bad bots and some proxies RewriteCond %{REMOTE_HOST} 12.226.240.248 [OR] RewriteCond %{REMOTE_HOST} 24.111.102.26 [OR] RewriteCond %{REMOTE_HOST} 24.117.121.113 [OR] RewriteCond %{REMOTE_HOST} 65.30.216.140 [OR] RewriteCond %{REMOTE_HOST} 67.87.64.23 [OR] RewriteCond %{REMOTE_HOST} 68.12.149.198 [OR] RewriteCond %{REMOTE_HOST} 69.139.167.203 [OR] ...
    – RRN
    Aug 27, 2012 at 11:11
  • This is the content from "/.htaccess": # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
    – RRN
    Aug 27, 2012 at 11:13
  • It seems some plugins are using "wordpress/.htaccess", but "/.htaccess" is also working, do you think it is safe to keep working like that? Thanks.
    – RRN
    Aug 27, 2012 at 11:19
  • As lacqui mentioned in his answer, Apache will get what ever it needs from all .htaccesses that you create but those that are more specific will overrule those closer to the root directory. This means you can have your rules split over multiple files. Or even shorter: Yes its ok to keep it that way.
    – Jan Beck
    Aug 28, 2012 at 15:16
0

Looks to me like you have WordPress installed in a subdirectory. There is an in-depth explanation about that in the codex: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Step 7 mentions that the .htaccess file should be copied and not moved from the subdirectory to the root. So yes, having two .htaccess files is normal when you have set up your WordPress installation in a subdirectory.

1
  • But the contents is not the same, please check the contents in another comments on this page. Thanks.
    – RRN
    Aug 27, 2012 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.