我希望爲移動設備用戶的請求只能http://mydomain.com/video.html重定向到http://mydomain.com/mobile/index.html移動用戶特定的頁面請求目前這是一個WordPress的網站,所以已經有一些WordPress的東西在我的。 htaccess文件。使用的.htaccess</p> <p>重定向僅適用於使用htaccess的
這是我現在有:
AddHandler php5-script .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN Mobile redirect for the video
<IfModule mod_rewrite.c>
RewriteEngine on
# stuff to let through (ignore)
RewriteCond %{REQUEST_URI} "/mobile/"
RewriteRule (.*) $1 [L]
#
RewriteCond %{REQUEST_URI} !^/html/video.html.*$
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ /mobile/index.html [L,R=302]
</IFModule>
# END Mobile redirect
這是目前重定向我的iPad的所有網頁,而不是爲網頁我希望它(video.html)
我缺少的東西?
謝謝你的答案被替換。我只是嘗試了你的解決方案,現在它不再重定向任何東西。所以它解決了一個問題 - 重定向其他頁面,但我仍然有問題將它重定向video.html到/mobile/index.html。 – flyboy
我應該提一下,我已經嘗試了WordPress塊前後的新塊,獲得了相同的結果,但現在已經根據您的建議將其留在了現在。 – flyboy
此外,爲了響應你的#2,我有這條線,因爲沒有它,我得到一個Apache錯誤的重定向太多。隨着這條線路的到來,重定向不再重複。合理? – flyboy