我想重定向http://127.0.0.1/upload/load/1/www.google.com 至 www.google.com
每个网址的http://127.0.0.1/upload/load/保持不变,最后一部分/1/www.google.com更改为/2 /www.amazon.com/,/3/www.aol.com等。
我试过这样做,但它给了我重定向循环错误。 我的htaccess文件看起来像这样。
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^admin$ Admin/index.php?qstr=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php?qstr=$1 [L]
更新了htaccess
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)/?$ index.php?qstr=$1 [L]
RewriteRule ^upload/load/[0-9]+/(.*)$ http://$1 [NC,L,R]
我认为你说要注释的规则是允许我的文件工作的规则。愿这就是原因。所以我必须遵守这条规则。
添加重写日志代码后我进一步更新了htaccess(这显示了内部服务器错误)
Options +FollowSymLinks
Options +Indexes
# Roll your own Rewrite log
# Log details via scale of 1 to 9
# 1 = few details, 5 = enough details, 9 = too much detail
RewriteEngine On
RewriteLog “d:/wamp/rewrite.log”
RewriteLogLevel 5
RewriteRule ^upload/load/[0-9]+/(.*)$ http://$1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php?qstr=$1 [L]
答案 0 :(得分:2)
使用此规则:
RewriteRule ^upload/load/[0-9]+/(.*)$ http://$1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php?qstr=$1 [L]
但是我必须说明你的问题陈述和你的尝试规则根本不匹配。