When WordPress Does Not Provide an .htaccess File for New Multisite Sites because of CPanel Fantastico Auto-Installer?

wordpress.stackexchange https://wordpress.stackexchange.com/questions/1339

  •  16-10-2019
  •  | 
  •  

문제

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 ?

도움이 되었습니까?

해결책

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
</Files>

Good luck :)

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top