Hi Everyone I try find a similar case in the forums; but I didn't find one, then I proceed to put my consult. I have a simple site that is not based in a CMS, an the site is in a subfolder named "newsite" in the root folder (web). As I want the subdirectory not to be displayed when the site is loaded, I simplement go to the tap redirect and set the Redirect Type to "L", set the Redirect Path to the sub directory name and the redirect work like silk. The issue happen when try to access to stats or in case of write a page that not exist the customize error page can not redirect. I understand very well that problems is because the folder stats and error and the previus rules are not set in the folder. I whant to know how to make work the error pages and the stats in the subfolder redirect. I tryed some soluctions that work, but not as perfect as I want. Solution for error pages: 1 - The most simple, copy the error dir to the subdir site. 2 - Make a simlink of the error dir in the subdir site and set the correct grants. Solution for stats: 1 - Not create the redirection in the Redirect Tab. 2 - Creat a .htaccess file in the root dir (web/) with the next rewrite rules: # skip stats/index.php from any redirects below RewriteCond %{THE_REQUEST} /stats/index\.php[?/\s] [NC] RewriteRule ^ - [L] # skip stats/awstats.domain.com.*.html from any redirects below RewriteCond %{THE_REQUEST} /stats/awstats\.domain\.com\.(.+)\.html[?/\s] [NC] RewriteRule ^ - [L] # skip stats/awsindex.html from any redirects below RewriteCond %{THE_REQUEST} /stats/awsindex\.html[?/\s] [NC] RewriteRule ^ - [L] # skip stats/SUBDIR/awstats.domain.com.*.html from any redirects below RewriteCond %{THE_REQUEST} /stats/(.+)/awstats\.domain\.com\.(.+)\.html[?/\s] [NC] RewriteRule ^ - [L] # skip stats/SUBDIR/awsindex.html from any redirects below RewriteCond %{THE_REQUEST} /stats/(.+)/awsindex\.html[?/\s] [NC] RewriteRule ^ - [L] # Installed Site In Subdirectory RewriteEngine on RewriteCond %{THE_REQUEST} subdirectory/ RewriteRule ^newsite/(.*) http://domain.com/$1 [R=301,L] RewriteCond %{REQUEST_URI} !newsite/ RewriteRule ^(.*)$ /newsite/$1 [L] Not work perfectly because the stats not show automatic and I need to write index.php and the images of awstats-icon not show well. Someone with better idea of how I could improve this or do better? Note: ISPConfig 3.1 with Apache 2.4
I made a improvement in the code of the redirect of the htaccess. I get the same issue in stats. <IfModule mod_rewrite.c> RewriteEngine on # skip stats/index.php from any redirects below RewriteCond %{THE_REQUEST} /stats/index\.php[?/\s] [NC] RewriteRule ^ - [L] # skip stats/awstats.domain.com.*.html from any redirects below RewriteCond %{THE_REQUEST} /stats/awstats\.domain\.com\.(.+)\.html[?/\s] [NC] RewriteRule ^ - [L] # skip stats/awsindex.html from any redirects below RewriteCond %{THE_REQUEST} /stats/awsindex\.html[?/\s] [NC] RewriteRule ^ - [L] #skip stats/SUBDIR/awstats.domain.com.*.html from any redirects below RewriteCond %{THE_REQUEST} /stats/(.+)/awstats\.domain\.com\.(.+)\.html[?/\s] [NC] RewriteRule ^ - [L] #skip stats/SUBDIR/awsindex.html from any redirects below RewriteCond %{THE_REQUEST} /stats/(.+)/awsindex\.html[?/\s] [NC] RewriteRule ^ - [L] RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteCond %{REQUEST_URI} !^/newsite/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /newsite/$1 RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteRule ^(/)?$ newsite/index.html [L] <IfModule mod_rewrite.c>
Forget it. This solve the issue. <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteCond %{REQUEST_URI} !^/newsite/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /newsite/$1 RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteRule ^(/)?$ newsite/index.html [L] <IfModule mod_rewrite.c>