问题描述
使用.htaccess文件,我怎么可以加载网页B
在页A
加载?我不希望URL改变,它仍然应该说页A
。
Using the .htaccess file, how can I load page B
when page A
is loaded? I do not want the URL to change, it should still say page A
.
例如:用户负载 www.mysite.com/contact
并获得 www.mysite.com/contact-us $的结果C $ C>
example: user loads www.mysite.com/contact
and gets the results of www.mysite.com/contact-us
preferably,我怎么能重定向到同一个地方多个网址?如 .COM / A
, .COM / B
和 .COM / C
所有负载的 .COM / D
的内容。有没有一种方法,以集团的许多那些在一起(而不是该解决方案: htaccess的重定向不改变网址)
Preferably, how can i redirect multiple URLs to the same place? Such as .com/A
,.com/B
, and .com/C
all load the content of .com/d
. Is there a way to group many of those together (as opposed to this solution: htaccess redirect without changing url)
推荐答案
根据您的网址布局我会像这样的东西去:
Depending on your URL layout I would go with something like this:
RewriteCond %{REQUEST_URI} ^/(A) [OR,NC]
RewriteCond %{REQUEST_URI} ^/(B) [OR,NC]
RewriteCond %{REQUEST_URI} ^/(C) [OR,NC]
RewriteCond %{REQUEST_URI} ^/(E)
RewriteRule ^.*$ /d#%1 [L]
当然,你也可以做一个行:
Of course you can also do it in one line:
RewriteCond %{REQUEST_URI} ^/(A|B|C|E) [NC]
RewriteRule ^.*$ /d#%1 [L]
这篇关于没有重定向htaccess的负载网页B,而不是网页A的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!