我怎样才能让我的htaccess的工作(子域)?我的、工作、htaccess

由网友(㈦秒鍾の記憶)分享简介:我是八九不离十一noob这些东西,但我想作一个简单的虚拟子站点的.htaccess。我有通配符启用和大量挖掘后,这是我想出来的:I'm sorta a noob at these things but I'm trying to make a simple virtual subdomain with .htacce...

我是八九不离十一noob这些东西,但我想作一个简单的虚拟子站点的.htaccess。我有通配符启用和大量挖掘后,这是我想出来的:

I'm sorta a noob at these things but I'm trying to make a simple virtual subdomain with .htaccess. I have wildcard enabled and after lots of digging, this is what I've come up with:

rewriteEngine On 
rewriteCond %{HTTP_HOST} !^$ 
rewriteCond %{HTTP_HOST} !^(www.)?khpedia.com$ [NC] 
rewriteCond %{HTTP_HOST}<->%{REQUEST_URI} ^(www.)?([^.]+).*<->/([^/]+) [NC] 
rewriteCond %2<->%3 !^(.*)<->1$ [NC] 
rewriteRule ^(.+) /%2/$1 [L]

我的目录设置为

My directory is setup as

-root --wiki ---- index.php文件 --test

-root --wiki ----index.php --test

现在,当我前往wiki.khpedia.com,我得到找不到网页。当我前往wiki.khpedia.com/index.php~~V,它传播到wiki.khpedia.com/wiki/index.php~~V。我好歹也是能够访问wiki.khpedia.com/test。如果它不似乎是显而易见的是,我希望能够去wiki.khpedia.com/index.php~~V看看wiki.khpedia.com/wiki/index.php但不是在我的地址栏。很抱歉的文本块,并感谢您的帮助。

Right now when I travel to wiki.khpedia.com, I get a page not found. When I travel to wiki.khpedia.com/index.php, it travels to wiki.khpedia.com/wiki/index.php. I am somehow also able to access wiki.khpedia.com/test. If it doesnt seem obvious yet, I want to be able to go to wiki.khpedia.com/index.php and see wiki.khpedia.com/wiki/index.php but not in my address bar. Sorry for the text block and thanks for the help.

推荐答案

这适用于Apache的一面:

This works on the Apache side:

RewriteCond %{HTTP_HOST} !^www.khpedia.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.+).khpedia.com$  [NC] 
RewriteRule ^(.*) /%1/$1 [L,QSA]

但你的wiki软件就可以弥补它自己的主意重定向/网址。

But you're wiki software might make up it's own mind about redirects / urls.

阅读全文

相关推荐

最新文章