开发者

htaccess redirect to mobile website. Keep the same trailing path

I have my website automtically redirecting to a mobile version if the user has an iphone or ipod with .htaccess. But I would like to keep the same link structure.

For example: 开发者_C百科 http://www.domain.com/status/?variable=12345678

Currently redirects to: http://iphone.domain.com/

The end of the link is lost. So in the end I would like it to keep the end of the url and go to

http://iphone.domain.com/status/?variable=12345678


Something along the lines of

RewriteCond %{HTTP_HOST} ^www.domain.com
RewriteRule ^(.*)$ http://iphone.domain.com/$1

should work. The $1 is the key.

This will take http://www.domain.com/your-exact-path

and change it to http://iphone.domain.com/your-exact-path

You will of course still need to determine whether the user is accessing from a phone before using this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜