I have installed WordPress via an auto-installer and later configured it as multisite. But whenever I create the WordPress site using auto-installer it doesn't give me the .htaccess file by default. So I've created an empty file with the name .htaccess in CPanel and pasted this code in to it:

RewriteEngine On 
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files 
RewriteRule ^files/(.+)wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f
[OR] RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^ - [L] 
RewriteRule . index.php [L]

Is it a right method ?

  • Please consider to better format your question. The title could use some better wording as well. I have problems to understand you properly so it's hard to help. But I think your question is valid, so if you can improve it, I'll give it a point.
    – hakre
    Sep 4, 2010 at 17:26
  • @hakre - I edited for him. You could do the same. Poor formatting reflects badly on the site more than it reflect badly on a @user402 with 1 reputation point. So rather than wait on them who may never, just do it (and leave them a comment asking them to do it next time.) Sep 4, 2010 at 19:08
  • I am extremely sorry for poor formatting of the question.I will improve making my questions clear . Sorry again !
    – Name-AK
    Sep 5, 2010 at 1:32

2 Answers 2


Sure this is not a problem. As long as you site works and redirects to the right pages there is no harm in doing this. You might also want to use it for protecting your wp-config file from hackers by adding this to your .htaccess:

<Files wp-config.php>
 Order Allow,Deny
 Deny from all

Good luck :)

  • Thank you ! I will add this code to wp-config.php file .
    – Name-AK
    Sep 5, 2010 at 1:35
  • @user402: You add it to your .htaccess file, not to wp-config.php. It tells the server to deny access to wp-config.php. If you ever disable PHP for some reason, this will prevent the server from sending it as a plain text file, with your password in it.
    – Jan Fabry
    Sep 5, 2010 at 8:35
  • Sorry I have mistyped here in this comment.I have added it to .htaccess file successfully .
    – Name-AK
    Sep 5, 2010 at 11:25

The .htaccess file should be automatically created by wordpress when you activate pretty permalinks. In case it did not, wordpress will show you the code you should use to create the file manually.

If you're in doubt which code to use, I would disable pretty permalinks in the backend, back-up and then remove the current .htaccess file. Then I would go into the backend to activate pretty permalinks again and follow the instructions given.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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