我正在尝试使用htaccess文件为用户重写URL,这样用户就可以很容易地记住并确保地址栏保持凉爽。我完成了重写-
重写的URL
www.mysite.com/index.php?profile=2345
需要实际URL
www.mysite.com/profile/2345
.htaccess
RewriteRule ^profile/([0-9]+)/?$ index.php?profile=$1 [NC,L]
无法
**1.多个**
www.mysite.com/profile=2345&a=65&b=34&c=7&d=54
进入
www.mysite.com/profile/2345/a/65/b/34/c/7/d/54
2.有可能像这样走得更远吗
profile.mysite.com/2345/a/65/b/34/c/7/d/54
1。
RewriteRule ^profile/([0-9]+)/a/([0-9]+)/b/([0-9]+)/c/([0-9]+)/d/([0-9]+)/?$ index.php?profile=$1&a=$2&b=$3&c=$4&d=$5 [NC,L]
2.
RewriteCond %{HTTP_HOST} ^profile.mysite.com$
RewriteRule ^([0-9]+)/a/([0-9]+)/b/([0-9]+)/c/([0-9]+)/d/([0-9]+)/?$ index.php?profile=$1&a=$2&b=$3&c=$4&d=$5 [NC,L]
3.
RewriteCond %{HTTP_HOST} ^([a-z]+).mysite.com$
RewriteRule ^([0-9]+)/([abcd])/([0-9]+)/([abcd])/([0-9]+)/([abcd])/([0-9]+)/([abcd])/([0-9]+)/?$ index.php?%1=$1&$2=$3&$4=$5&$6=$7&$8=$9 [NC,L]
RewriteCond %{HTTP_HOST} ^([a-z]+).mysite.com$
RewriteRule ^([0-9]+)/([abcd])/([0-9]+)/([abcd])/([0-9]+)/([abcd])/([0-9]+)/?$ index.php?%1=$1&$2=$3&$4=$5&$6=$7 [NC,L]
RewriteCond %{HTTP_HOST} ^([a-z]+).mysite.com$
RewriteRule ^([0-9]+)/([abcd])/([0-9]+)/([abcd])/([0-9]+)/?$ index.php?%1=$1&$2=$3&$4=$5 [NC,L]
RewriteCond %{HTTP_HOST} ^([a-z]+).mysite.com$
RewriteRule ^([0-9]+)/([abcd])/([0-9]+)/?$ index.php?%1=$1&$2=$3 [NC,L]
RewriteCond %{HTTP_HOST} ^([a-z]+).mysite.com$
RewriteRule ^([0-9]+)/?$ index.php?%1=$1 [NC,L]