问题原文
原帖链接 · Sindyr · CC BY-SA 4.0
OK, I have a basic php website (non WordPress) that I just moved from GoDaddy to Nixihost. By default, the root website gets put in the root web folder /public_html - however instead I wanted the root website in a subfolder of the root web folder at /public_html/4efix.com (The website in question is my simple www.4efix.com)
At GoDaddy I had the following .htaccess file in the /public_html and it worked perfectly, it even rewrote all http requests to https ones:
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?4efix.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/4efix.com/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /4efix.com/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?4efix.com$
RewriteRule ^(/)?$ 4efix.com/index.php
rewriterule ^news$ "http\:\/\/eepurl\.com\/AjC-j" [R=301,L] #57e44bbcecccd
But now that I moved to Nixihost, when I visit www.4efix.com I get
Forbidden
You don't have permission to access /4efix.com/403.shtml on this server.
Server unable to read htaccess file, denying access to be safe
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
When I remove the .htaccess I get a directory listing of the /public_html folder, which seems to indicate it is a .htaccess issue.
What should my correct .htaccess file be, or do I have my .htaccess file correct and the problem is with Nixihost's server?
已采纳解答
原帖链接 · Sindyr · CC BY-SA 4.0
So for some reason I still do not fathom, the fix turned out to be altering the target directory's permission from 750 to 755. (The files within the directory did not have to have their permissions altered at all, just the folder containing the redirected site.)
That was the answer, discovered by the helpful folks at Nixihost.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
