我正在尝试使用htaccess文件为用户重写URL,以便用户可以轻松记住并确保地址栏保持凉爽。
www.mysite.com/index.php?profile=2345
www.mysite.com/profile/2345
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]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句