我喜欢重写网址,但我的.htaccess中的规则并不匹配。 .htaccess在" foo"文件夹中。
有两种网址:
http://www.domain.com/foo/Fgh34R #Always 6 Chars after the "/" A-Za-z0-9
#should be redirected to
http://www.domain.com/foo/index.php?s=Fgh34R
http://www.domain.com/foo/http://www.google.com
#should be redirected to
http://www.domain.com/foo/index.php?u=http://www.google.com
到目前为止,这是我的.htaccess:
RewriteEngine On
RewriteRule ^\/(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?$ index.php?u=$1
RewriteRule ^\/([A-Za-z0-9]{0,6})$ index.php?s=$1
有人可以帮我吗?
答案 0 :(得分:0)
您可以尝试以下操作。
RewriteEngine On
RewriteRule ^foo/(https?://\S+)$ foo/index.php?u=$1
RewriteRule ^foo/([a-zA-Z0-9]{6})$ foo/index.php?s=$1