【发布时间】:2019-09-04 01:47:41
【问题描述】:
您好,我正在尝试制作博客演示,并且已经有了一些漂亮的 URL 代码。
我有一个网址www.xyz.com
还有一个搜索网址www.xyz.com/search/this+is+a+search+text
在搜索网址中,参数search 是页面名称,this+is+a+search+text 是我将要解析的参数
我已经在下面有一个 .htaccess 代码
# code to make pretty URLS | we're using this code to achieve /category/slug
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.+)/([\w-]+)/([\d]+)$ app/post.php?&category=$2&page=$3 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.+)/([\w-]+)/([\w-]+)$ app/post.php?&category=$2&slug=$3 [L,QSA]
# code to make pretty URLS for search page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.+)/([\w-]+)/([\d]+)$ app/search.php?&searchstring=$2&page=$3 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.+)/([\d]+)$ app/index.php?page=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.+)/([\w-]+)$ app/post.php?category=$2 [L]
我在搜索页面使用下面的代码
# code to make pretty URLS for search page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.+)/([\w-]+)/([\d]+)$ app/search.php&searchstring=$2&page=$3 [L,QSA]
但在使用代码时,我收到 500 条内部错误消息,但我无法弄清楚错误是什么!
如果有人能帮助我解决这个逻辑,我将不胜感激。
【问题讨论】:
-
请检查您的错误日志文件,会有更多关于 500 错误的信息。
-
上面写着
[Sun Apr 14 00:24:04.450503 2019] [core:error] [pid 7204:tid 1244] [client ::1:11856] 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://www.myblog.com/diy -
您是否按照此日志消息的提示进行操作?设置您的
LogLevel debug可能会让您更接近关于内部重定向为何不断发生的答案。 -
怎么做?
-
您的规则相互冲突。最好把需求写清楚,以便在重构规则时获得更好的帮助。