我最近为我的网站创建了一个移动版本并重定向到移动版本。移动版本位于我根目录的子域(文件夹)中。重定向是通过根目录中所有文件的标头中的 php 脚本完成的,到目前为止,index.php
它正在工作。
现在我需要将规则添加到我的htaccess
所有 url 中,就像普通根目录一样,也可以在子域文件夹中工作/保持相同的结构。
www.mysite.com
对于移动设备,它是m.mysite.com
网站中的url结构:
For desktop following urls and files out of root
www.mysite.com/basisscholen/
www.mysite.com/middelbaar-onderwijs/
www.mysite.com/hbo-universiteit/
www.mysite.com/basisscholen/plaats/m/
www.mysite.com/middelbaar-onderwijs/plaats/m/
www.mysite.com/hbo-universiteit/plaats/m/
www.mysite.com/basisscholen/plaats/m/miami/
www.mysite.com/basisscholen/plaats/m/miami/myschool/
For desktop following urls and files out of folder (m) so that different css can be used:
m.mysite.com/basisscholen/
m.mysite.com/middelbaar-onderwijs/
m.mysite.com/hbo-universiteit/
m.mysite.com/basisscholen/plaats/m/
m.mysite.com/middelbaar-onderwijs/plaats/m/
m.mysite.com/hbo-universiteit/plaats/m/
m.mysite.com/basisscholen/plaats/m/miami/
m.mysite.com/basisscholen/plaats/m/miami/myschool/
这是我的普通桌面版本的 htacces 规则:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^m\.
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC]
RewriteRule ^ xx-xxxx%{REQUEST_URI} [L,NC,R=302]
RewriteRule ^\.html$ /index.php
RewriteRule ^basisscholen/$ basisscholen.php?id=basisscholen [L]
RewriteRule ^middelbaar-onderwijs/$ middelbaar-onderwijs.php?id=middelbaar-onderwijs [L]
RewriteRule ^hbo-universiteit/$ hbo-universiteit.php?id=middelbaar-onderwijs [L]
RewriteRule ^basisscholen/plaats/([A-Za-z0-9-]+)/?$ basisscholen.php?letter=$1 [L,B]
RewriteRule ^middelbaar-onderwijs/plaats/([A-Za-z0-9-]+)/?$ middelbaar-onderwijs.php?letter=$1 [L,B]
RewriteRule ^hbo-universiteit/plaats/([A-Za-z0-9-]+)/?$ hbo-universiteit.php?letter=$1 [L,B]
RewriteRule ^([^/]+)/plaats/([^/]+)/([^/]+)/?$ plaats.php?type=$1&letter=$2&link=$3 [L,B]
RewriteRule ^([^/]+)/plaats/([^/]+)/([^/]+)/([^/]+)/?$ school.php?type=$1&letter=$2&plaatsnaam=$3&schoolnaam=$4 [L,B]
我需要的是 htacces 规则应该如何让子域 url 结构与主站点完全一样。有很多白屏,禁止访问或所有 url 重写到子域。
还尝试了很多其他主题的建议,有人可以帮助我吗?
心电图