I cannot get to the bottom of this.
Currently, if I enter mydomain/forum or /forum/ I get a 403. Within the forum directory I have this .htaccess:
<IfModule mod_rewrite.c>
Options -MultiViews +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(jpeg|jpg|gif|png)$ /forum/public/404.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /forum/index.php [L]
</IfModule>
And within the parent directory I have this .htaccess:
Options FollowSymLinks -Indexes
DirectorySlash Off
# Apache Rewrite Rules
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteOptions AllowNoSlash
RewriteBase /
# 1. Redirect www to non-www ✓
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
# If the host contains www, disregarding case, redirect to a non-www URL
RewriteRule ^(.*)$ http://%1/$1 [R,L]
# 2. Redirect trailing slash to non-trailing ✓
RewriteCond %{ENV:REDIRECT_LOOP} !1
RewriteRule ^(.+[^/])/$ http://%{HTTP_HOST}/$1 [R,L]
# Pattern: One or more characters that don't end in a slash, all ending in a slash
# Redirect /index.php or /index.html to non ✓
RewriteCond %{REQUEST_URI} /index\.(html|php)(\?.*)?$ [NC]
#If the request URI contains /index.html or php at the end, remove it and redirect the browser
RewriteRule ^(.*)/index\.(html|php)(\?.*)?$ $1 [NC,R,NE,L]
# Redirect /dir/foo.(php|html) to /dir/foo ✓
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.(html|php) [NC]
RewriteRule .* %1 [R,NC,L]
# 3. Make it so trailing slashes aren't required for directories ✓
RewriteCond %{REQUEST_FILENAME}/ -d
RewriteCond %{REQUEST_FILENAME} !-f
#If it isn't a file but would be a directory
RewriteCond %{REQUEST_URI} !/$
#If it doesn't end in a slash already
RewriteRule ^(.*)$ $1/ [E=LOOP:1]
#Give it a slash internally, set the environment loop variable to 1 to prevent rewrite 2 from creating an infinite loop
# 4. Make it so URL doesn't require .php
RewriteCond %{REQUEST_FILENAME} !-d
# If the requested filename is not a directory
RewriteCond %{REQUEST_FILENAME}\.php -f
# If the requested filename is a valid php file, serve it to the browser.
RewriteRule ^([^.]+)$ $1\.php
# 4. Make it so URL doesn't require .html
# Input would be draw.academy/article
# Output would be draw.academy/article.html, but only internally
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^([^.]+)$ $1\.html
# 5. Serve /learn from /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#If it isn't already a file or directory
RewriteCond %{REQUEST_URI} !^/learn/?$
#If it isn't the learn directory itself...
RewriteCond %{DOCUMENT_ROOT}/learn/$1\.php -f
#ONLY if the file would exist in the learn directory. This preserves the 404 function.
RewriteRule ^(.*)$ /learn/$1
#Serve the file as if it were the in the learn directory
# 6. Serve /includes from /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#If it isn't already a file or directory
RewriteCond %{REQUEST_URI} !^/includes/?$
#If it isn't the includes directory itself...
RewriteCond %{DOCUMENT_ROOT}/includes/$1\.php -f
#ONLY if the file would exist in the includes directory. This preserves the 404 function.
RewriteRule ^(.*)$ /includes/$1
#Serve the file as if it were the in the includes directory
# 7. Prevent hotlinking and show logo instead
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?directdrawing.com [NC]
# RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?sentientoak.com [NC]
# RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?(\w+\.)?draw.academy [NC]
# RewriteRule \.(jpg|jpeg|png|gif)$ http://i.imgur.com/r9bAyps.png [NC,R,L]
</IfModule>
Finally, if I enter /forum/index.php and anything after, it works fine. What gives??