1

次のルールを持つ.htaccessファイルがあります

# replace 'RewriteBase' with current working folder
# put '<base href="/">' in <head> if you are in the root folder
# put '<base href="/foldername/">' in <head> if you are in a subfolder of the root
Options +FollowSymLinks
RewriteEngine On
RewriteBase /pretty-urls

# Remove slash if file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ $1 [R=301,L]

# Redirect to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ $1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)$ user.php?u=$1 [NC]

www.mysite.com/about.phpこれは基本的に、次の URL のいずれかを変換www.mysite.com/aboutしてリダイレクトwww.mysite.com/about/www.mysite.com/aboutますwww.mysite.com/user/john

何が問題なのかわかりません。コードはこれに基づいています ( How-to? Vanity URL & ignore .PHP extension with .htaccess )

私のphpは次のようになります

foreach ( $users as $user ) {
    echo '<p><a href="user/'.$user->username.'">'.$user->username.'</a></p>';
}

どんな助けでも大歓迎です、ありがとう。

編集:Apacheエラーログは言う

[Fri Sep 27 14:26:26.539589 2013] [core:error] [pid 2276:tid 1680] [client ::1:60023] 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., referer: http://localhost/pretty-urls/users

提案どおり、フラグを削除して[NC]フラグを追加しました[L]が、同じエラーが続きます。

4

1 に答える 1