Reputation: 1512
I'm trying to get a webpage running which might not get any support anymore, so I have to fix this on my own. So in the root directory, I have this .htaccess
file:
RewriteEngine on
RewriteBase /
RewriteRule ^(.*) resources/$1 [L]
So all the content gets redirected to the resources/
folder. Now this kinda works, as the frontpage shows all the static content (CSS, JS, Images). But when I try to open mydomain.com/admin
, I'll get an HTTP 500
. The logfile says
AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
The .htaccess
file in the sub-dir has this content:
Options -MultiViews
RewriteEngine On
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?param=$1 [QSA,L]
For my basic Apache knowledge this does seems quite right; but is it, or do I have change Apache settings? (The VPS is a kind of PaaS-thing, so I can access/change some things)
Thank you.
Upvotes: 0
Views: 54
Reputation: 133650
Have your root htaccess rule file in following way(you need to put a condition for a check before rewriting).
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/resources [NC]
RewriteRule ^(.*)$ resources/$1 [L]
Then for your sub directory level htaccess file try following:
Options -MultiViews
RewriteEngine On
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?param=$1 [QSA,L]
Also in case you want to apply same rules which you have in your root directory to sub-directories then add RewriteOptions InheritBefore
before RewriteEngine ON
in your sub directory level htaccess file.
Upvotes: 1