我已经为我的网站实现了下面的htaccess代码。
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# external redirect from /category.php?id=name&phrase=something to /name/something
RewriteCond %{THE_REQUEST} \s/+category\.php\?id=([^&]+)&phrase=([^\s&]+) [NC]
RewriteRule ^ %1/%2? [R=302,L]
# skip files and directories from rewrites
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# Cleans up all the article, and wrestler pages
RewriteRule ^/?article/([^/]+)/?$ article.php?id=$1 [L,QSA]
RewriteRule ^/?wrestler/([^/]+)/?$ wrestler.php?id=$1 [L,QSA]
# Removes the .php extension from pages
RewriteCond %{DOCUMENT_ROOT}/$1.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]
# For the redirecion of related topics links on wrestler profile pages
RewriteRule ^([^/]+)/([^/]+)/?$ category.php?id=$1&phrase=$2 [L,QSA]
#IGNORE CODE BELOW, IT IS ALL COMMENTED OUT
#For homepage redirections. It works if added at very front of code, but overall problem still not solved (links hovered over show true link)
#RewriteCond %{THE_REQUEST} \s/+article\.php\?id=([^\s&]+) [NC]
#RewriteRule ^ article/%1? [R=302,L]
#internal forward from pretty URL to actual one
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^article/([^/]+)/?$ article.php?id=$1 [L,QSA,NC]
我遇到的问题是,当我在我的网站上有链接时
www.domain.com/
自动成功
http://domain.com/wrestler/www.domain.com/
即使是
www.domain.com
(注意域名末尾没有“/”,它仍然会重定向到上面的链接。这不应该发生。我很困惑是什么导致了这个。我该怎么办?