内部重定向-PHP和.htaccess


Internal Redirect - PHP and .htaccess?

晚上好,我想知道是否可以将请求重定向到我的页面http://test.diogo.me到包含内容的页面->http://www.diogo.me/pages/test/(此重定向必须是内部的…浏览器应指向http://test.diogo.me)。我一直在读.htaccess,我觉得这就是我的决心。
我已尝试使用以下代码:

 <IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} !^www'.diogo'.me [NC]
RewriteCond %{HTTP_HOST} ([^.]+)'.diogo'.me [NC]
RewriteRule ^(.*)$ /%1/$1 [L]

输出是错误404文件找不到:(
我走对了吗?
很抱歉我的表达限制。提前感谢

只需将此代码放在.htaccess中,并从中删除现有行:

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test'.diogo'.me$ [NC]
RewriteRule ^$ http://www.diogo.me/pages/test/ [L,P]

您缺少/pages部件

RewriteCond %{HTTP_HOST} !^www'.diogo'.me [NC]
RewriteCond %{HTTP_HOST} ([^.]+)'.diogo'.me [NC]
RewriteRule ^(.*)$ /pages/%1/$1 [L]

假设子域与主域具有相同的文档根。