域名指向一个单页 [英] Domain to point to a single page

查看:146
本文介绍了域名指向一个单页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想点一域名为单页,并保持域相同(无重定向)。

I'm trying to point a domain name to a single page, and keep the domain the same (no redirect).

因此​​,如果用户键入:www.domain1.com.au - >原网站显示

So if a user types: www.domain1.com.au --> original site is shown

如果用户键入:www.domain2.com.au - >它们显示www.domain1.com.au/second.php,但网址仍然说www.domain2.com.au

If a user types: www.domain2.com.au --> they are shown www.domain1.com.au/second.php, but the URL still says www.domain2.com.au.

可以这样做使用的.htaccess?

Can this be done using .htaccess?

目前.htaccess文件的片段是:

Snippet of current .htaccess file is:

RewriteCond %{HTTP_HOST} www\.domain2\.com\.au [NC] 
RewriteRule (.*) /two [L] 

RewriteCond $1 ^(one|two|three|four) [NC] 
RewriteRule ^(.*)$ /index.php/$1 [L]

所以基本上www.domain2.com.au需要显示www.domain1.com.au/two页面,这确实是www.domain1.com.au/index.php/two

So basically the www.domain2.com.au needs to display the www.domain1.com.au/two page, which really is www.domain1.com.au/index.php/two

推荐答案

您肯定可以做这样的事情:

You could definitely do something like this:

RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com\.au$
RewriteCond %{REQUEST_URI} !^/domain1
RewriteRule (.*) /domain1/$1 [L]

RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com\.au$
RewriteCond %{REQUEST_URI} !^/domain2
RewriteRule (.*) /domain2/$1 [L]

您确切的情况下,将与此类似:

Your exact case would similar to this:

RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com\.au$
RewriteRule (.*) /second.php [L]

编辑:现在您已经发布了一个片段试试这个:

Now that you've posted a snippet try this instead:

RewriteCond %{HTTP_HOST} www\.domain2\.com\.au [NC] 
RewriteRule (.*) /index.php/two [L] 

RewriteCond $1 ^(one|two|three|four) [NC] 
RewriteRule ^(.*)$ /index.php/$1 [L]

这篇关于域名指向一个单页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆