我的移动应用程序有一个子域,例如http://m.traffic.domain.com 现在我希望我的用户可以通过访问http://m.traffic.domain.com/username 来访问他们的页面将在内部指向http://m.traffic.domain.com/index.php?username= $1 为此我有以下 .htaccess 重写代码,但它没有按预期工作,而是将所有页面重定向到http://m。 traffic.domain.com/index.php?username= $1 这个页面
# 默认使用 PHP5 Single php.ini
AddHandler 应用程序/x-httpd-php5s .php
AddHandler 应用程序/x-httpd-php .aspx
重写引擎开启
RewriteCond %{HTTP_HOST} ^m\.traffic\.domain\.com$ [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule ^(.+)$ mobile/index.php?username=%1 [L]
<文件 403.shtml>
命令允许,拒绝
允许所有人
</文件>
子域http://m.traffic.domain.com指向一个名为 mobile 的目录,可以访问http://traffic.domain.com/mobile