user3277570
user3277570

Reputation:

How to avoid Apache mod rewrite endless redirects?

My .htaccess is very simple:

Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteRule ^qmind/themen/([^/]*)/$ /qmind/themen/t/?art=$1 [L] RewriteRule ^qpodcast/podcasts/([^/]*)/$ /qpodcast/podcasts/?id=$1 [L] RewriteRule ^qmind/artikel/([^/]*)\/$ /qmind/artikel/?id=$1 [L]

The last two Rules works perfectly but the first one causes an Internal-Error. Apache shows: Request exceeded the limit of 10 internal redirects due to probable configuration error. but I can't find my mistake.

Apache Error-Log says also Use 'LogLevel debug' to get a backtrace. but I don't no how.

Thx for help!

Upvotes: 2

Views: 73

Answers (1)

exussum
exussum

Reputation: 18550

RewriteRule ^qmind/themen/([^/]*)/$ /qmind/themen/t/?art=$1 [L] 

lets take an example

qmind/themen/test

This runs as

qmind/themen/test
qmind/themen/t/art=test
qmind/themen/t/art=t

and then repearts the bottom one as the URL matches itself

You need to write the rule to accept /t/ as valid and not rewrite it

RewriteRule ^qmind/themen/([^/]*)/$ /qmind/themen/t/index.php?art=$1

should work as it no longer matches the original regex

Upvotes: 1

Related Questions