我有一个视频网站,我正在尝试创建一个移动版本,但是当我重定向我的视频页面时出现问题:它没有显示完整的网址。这是一个例子:
我想要这个重定向:
www.mydomain.com/videos/45062/thisisanexample.html
=> m.mydomain.com/videos/45062/thisisanexample.html
但它重定向到:
m.mydomain.com/videos.php?id=45062
结果是它重定向到正确的视频页面,但没有显示URL。这是我的htaccess,我希望有人可以提供帮助。
RewriteOptions inherit
#suPHP_ConfigPath /home/roberto/public_html/php.ini
#--------APACHE SETTINGS---#
DirectoryIndex index.php
Options -Indexes -Multiviews
ErrorDocument 404 /404.php
#--------PHP SETTINGS------#
php_flag register_globals off
php_flag magic_quotes_gpc off
php_flag display_errors off
php_flag allow_url_fopen on
php_value upload_max_filesize 1000M
php_value post_max_size 1000M
#--------REWRITE RULES-----#
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteRule ^page(.*).html$ index.php?page=$1 [L]
RewriteRule ^videos/(.*)/(.*).html$ video.php?id=$1 [L]
RewriteRule ^video/(.*)/(.*)/(.*)/$ video.php?id=$1 [L]
RewriteRule ^search/(.*)/page(.*).html$ index.php?mode=search&q=$1&page=$2 [L]
RewriteRule ^longest/page(.*).html$ index.php?mode=longest&page=$1 [L]
RewriteRule ^most-viewed/page(.*).html$ index.php?mode=mostviewed&page=$1 [L]
RewriteRule ^models/page(.*).html$ models.php?page=$1 [L]
RewriteRule ^top-rated/page(.*).html$ index.php?mode=toprated&page=$1 [L]
RewriteRule ^channels/(.*)/(.*)/page(.*).html$ index.php?mode=channel&channel=$1&page=$3 [L]
RewriteRule ^most-discussed/page(.*).html$ index.php?mode=discussed&page=$1 [L]
RewriteRule ^favorites/page(.*).html$ index.php?mode=favorites&page=$1 [L]
RewriteRule ^my-uploads/page(.*).html$ index.php?mode=my_uploads&page=$1 [L]
RewriteRule ^profiles/(.*).html$ templates/template.user_profile.php?id=$1 [L]
RewriteRule ^members/page(.*).html$ members.php?mode=members&page=$1 [L]
RewriteRule ^my-friends/page(.*).html$ all_friends.php?mode=friends&page=$1 [L]
RewriteBase /
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:www.domain.com]
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\.
# Can not read and write cookie in same request, must duplicate condition
RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$)
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC]
# Now redirect to the mobile site
RewriteRule ^(.*)$ http://m.domain.com/$1 [R=301,L]