htaccess URL重写,隐式单个URL转换

时间:2014-04-15 10:01:23

标签: php apache .htaccess mod-rewrite white-labelling

我在MY htaccess文件中写了URL重写条件以实现如下。但是我已经完成了所有排列组合,以通过.htaccess文件获得以下结果。

白色标签

http://www.Mayday.com/login.html => http://23.24.25.26/login.html#/varFooMayday
http://www.Hayday.com/login.html => http://23.24.25.26/login.html#/varFooHayday

varFooMayDay和varFooHayday也是常量值 login.html 实际上应该是使用网址重写隐式 login.html#/ varFooHayday

我需要写一个条件才能达到上述目的。

RewriteCond %{HTTP_HOST} ^(www.)?mayday.com$
RewriteCond %{REQUEST_URI} !^/kgbadmin/kgb/QTT/view/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /kgbadmin/kgb/QTT/view/$1

RewriteCond %{HTTP_HOST} ^(www.)?mayday.com$
RewriteRule ^(/)?$ kgbadmin/kgb/QTT/view/index.html [L]

请问有人帮我写这个URL重写器吗?

2 个答案:

答案 0 :(得分:0)

您可以遵守以下规则:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)?(Mayday|Hayday)\.com$ [NC]
RewriteRule ^(login\.html)$ http://23.24.25.26/$1#/varFoo%1 [L,NE,R]

RewriteCond %{HTTP_HOST} ^(www.)?mayday.com$
RewriteCond %{REQUEST_URI} !^/kgbadmin/kgb/QTT/view/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /kgbadmin/kgb/QTT/view/$1 [L]

RewriteCond %{HTTP_HOST} ^(www.)?mayday\.com$
RewriteRule ^(/)?$ kgbadmin/kgb/QTT/view/index.html [L]

答案 1 :(得分:-1)

如果要重定向到其他域/地址,则需要mod_proxy。