6
The code below works perfectly to direct all website traffic transparently into the folder www:
Options -Indexes +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /
# Verificar o destino
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Ignorar se estamos a apontar para a pasta do projeto
RewriteCond %{REQUEST_URI} !^/www/
# Ignorar se estamos a apontar para um ficheiro ou diretoria existente
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Direcionar tudo para a sub-pasta "www"
RewriteRule ^(.*)$ /www/$1 [L] [R=301,L]
The problem is in direct access via ww.example.com that despite serving the page in conditions, results in a HTTP Status code 403 forbidden which causes the failure of some services, including social shares.
However, if we access via ww.example.com/index.php the HTTP status code is correctly identified as 200 OK.
Question
How to solve the problem of access to www.example.com so that they continue to direct traffic, but result in HTTP status code 200 OK ?
Note: Web-site browsing is performed with simplified type Urls:
www.example.com/produtos/bananas/banana-da-madeira
Ever tried to use
Options +FollowSymLinks?– Leandro Amorim
Or put
RewriteRule ^(.*)[\\|\/]$ /www/$1/index.php [L] [R=301,L]before yourRewriteRule, I guess it is not identifying the default document in the destination folder.– Leandro Amorim