0

I have a website with this structure of files and folders

/
/.htaccess
/site
/site/.htaccess
/site/index.php
/admin

The content of first .htaccess file is:

#MOD_REWRITE START
Options FollowSymLinks
RewriteEngine On

#Blocking Libwww-perl access
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L]

RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ /$1-$2 [L,R]
RewriteRule ^((?!site/).*) /site/$1 [L,NC]

The content of second .htacces file which is in /site directory:

Options +MultiViews +FollowSymLinks

RewriteEngine On

RewriteBase /

#From www.domain.com to domain.com
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

#From domain.com to www.domain.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)$ [NC]
RewriteRule ^(.*)$ https://www.%1.%2/$1 [R=301,L]

RewriteRule ^(en|de)$ index.php?lang=$1 [NC,L,QSA]
RewriteRule ^(en|de)/$ index.php?lang=$1 [NC,L,QSA]
RewriteRule ^(en|de)/page/([^/\.]+)$ page.php?lang=$1&slug=$2 [NC,L,QSA]
RewriteRule ^(en|de)/page/([^/\.]+)/$ page.php?lang=$1&slug=$2 [NC,L,QSA]

RewriteRule ^(en|de)/([^/.]+)$ /$2?lang=$1 [NC,L,QSA]
RewriteRule ^(en|de)/([^/.]+)/$ /$2?lang=$1 [NC,L,QSA]
RewriteRule ^(en|de)/([^/.]+)/([^/.]+)$ /$2?lang=$1&id=$3 [NC,L,QSA]
RewriteRule ^(en|de)/([^/.]+)/([^/.]+)/$ /$2?lang=$1&id=$3 [NC,L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) /$1.php [NC,L,QSA]

When I open the website there is appear this error:

Not Found

The requested URL /test.com/site/index.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I'm trying everything but I can not find the problem.

Note: DirectoryIndex is index.php and that is not the problem!

3
  • DirectoryIndex is index.php first. That is not the problem. Commented Oct 29, 2017 at 19:51
  • What is the URL you are requesting? You should also disable MultiViews (instead of enabling it; which is what you are currently doing). This is only going to conflict with your mod_rewrite directives that append the .php file extension. Commented Oct 29, 2017 at 22:28
  • When I disable MultiViews then the pages which uses mod_rewrite return: Internal Server Error Commented Oct 30, 2017 at 19:07

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.