我做了一个.htaccess
到我的根目录下创建一个子级嵌套的.htaccess文件,假设它是sub.domain.ex
重定向到domain.ex/deb/
mod_rewrite的与
RewriteEngine On
RewriteBase/
RewriteCond %{HTTP_HOST} sub.domain.ex
RewriteCond %{REQUEST_URI} !deb/
RewriteRule ^(.*)$ /deb/$1 [L]
,这工作得很好。
现在,我去/deb/
并创建另一个.htaccess
具有以下
RewriteEngine on
RewriteRule ^([^/]+)/ /deb.php?app=$1 [NC]
的deb.php是打印参数“应用程序”的文件。 它的工作原理,但只有当我打电话http://sub.domain.ex/something/
(注意最后的斜线)。它只适用于最后的斜杠,如果我删除它,它不会,我希望它没有最后的斜线工作。
因此,我将规则更改为^([^/]+)
,但现在我有500个Apache内部错误。 正则表达式教练在我的身边与选择,也许我失去了一些东西。 感谢
UPDATE
我runinng疯了。 Mybe将一个.htaccess放在根目录下是错误的,因为它在另一个目录中创建了第3个sublevel doman和.htacces?因为我正在尝试一些技巧。 我用这个规则
RewriteEngine on
RewriteRule ^([^/]+)/ deb.php?app=$1 [NC]
在/deb
目录的.htacces,并提出了print_r($_GET);
和名为index.php的。所以如果它在cydia子层的index.php上转发我,并且不使用/deb/deb.php,那么这个redirectory根本不起作用。 重述。 我的目录结构是这样的:
/htdocs/ -> the root of the main domain level like www.example.com
---index.php -> home file of www.example.com
/htdocs/deb -> the root directory of the 3th sublevel domain (subdomain.example.com ->
---index.php
---deb.php
所以对于这是第3级域的.htaccess是之前在/htdocs./htaccess和描述。 “美化”链接的其他.htaccess位于/htdocs/deb/.htaccess中。我想,当你去subdomain.domain.com/someText其转换为deb.php?应用= someText
现在我tryed去subdomain.domain.com/deb.php....WTF!?该deb.php是/htdocs/deb/deb.php
首页清晰
谢谢,但这是不可能的。重定向网址是好的,因为如果我呼叫站点sub.domain.ex/testname,它会回显/deb/deb.php上的php文件的内容 如果只是回显$ _GET ['app']值,只是为了测试。所以问题,即其他地方,我认为在rgeex,但我不知道 – Kreker 2010-06-23 20:35:52