简体   繁体   English

子域指向子文件夹,并且需要.htaccess重定向到Wordpress多站点子站点

[英]Subdomain Points to Subfolder and need .Htaccess to Redirect to a Wordpress Multi-Site Sub-Site

Ok, since a subdomain has to point to a real place, I created the subdomain pra.aquizone.net to point to aquizone.net/blogs/links/pra. 好的,因为子域必须指向真实位置,所以我创建了子域pra.aquizone.net来指向aquizone.net/blogs/links/pra。 The Wordpress (WP) Multi-site (MU) that I want to point to is aquizone.net/blogs/pra where that directory is virtually handled by the WP MU and the .htaccess under aquizone.net/blogs. 我要指向的Wordpress(WP)多站点(MU)是aquizone.net/blogs/pra,其中该目录实际上是由WP MU和aquizone.net/blogs下的.htaccess处理的。

I am assuming that I can change the .htaccess file under aquizone.net/blogs/link/pra to point to aquizone.net/blogs/pra and have the subdomain wind up resulting at aquizone.net/blogs/pra. 我假设我可以将aquizone.net/blogs/link/pra下的.htaccess文件更改为指向aquizone.net/blogs/pra,并将子域扩展为aquizone.net/blogs/pra。 Only everything I have tried does not work. 只有我尝试过的所有方法都不起作用。 Here is my currect .htaccess file: 这是我当前的.htaccess文件:

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php

RewriteEngine On
RewriteRule ^pra.*$ http://aquilone.me/blogs/pra/ [R=301,L]

The AddHandler was placed there by the subdomain creation and taking it out or leaving it makes no difference. 通过子域创建将AddHandler放置在此处,将其取出或保留都没有区别。 It does not work. 这是行不通的。 You can go to http://aquilone.me/blogs/links/pra/ and see it does not redirect. 您可以转到http://aquilone.me/blogs/links/pra/并看到它没有重定向。

How can I change this to work correctly? 我该如何更改才能正常工作?

Well, depending on your provider, you can point your subdomain towards the same directory of your top level domain, ie: example.com -> /public_html/ this.example.com -> /public_html/ 好吧,根据提供者的不同,您可以将子域指向顶级域的同一目录,即:example.com-> / public_html / this.example.com-> / public_html /

But your question is not clear about what you are trying to do. 但是您不清楚您要做什么。 Is it a subdomains network or is it a subfolders network? 它是子域网络还是子文件夹网络? If subdomains, try to change the directory your subdomain points to as in the example above, and create the blog inside wp-admin/network/ If subfolders, then you don't need the subdomain, unless you really want to redirect it to a subfolder just like an easier to remember shortcut, in that case you don't need a RewriteRule, WP takes care of the virtual subfolder. 如果是子域,请尝试如上例中那样更改您的子域指向的目录,并在wp-admin / network /中创建博客(如果有子文件夹),则不需要该子域,除非您确实希望将其重定向到子文件夹就像一个容易记住的快捷方式一样,在这种情况下,您不需要RewriteRule,WP会处理虚拟子文件夹。

I figured out what had happened. 我知道发生了什么事。 Anything from the aquizone.net/blogs forward was being handled by Wordpress and the .htaccess setup at this subfolder. Wordpress和此子文件夹中的.htaccess设置都处理了来自aquizone.net/blogs的所有内容。 Therefore, having the redirect point to aquizone.net/blogs/links/pra and in that folder have the .htaccess to then point it where I want was never being seen. 因此,将重定向指向aquizone.net/blogs/links/pra并在该文件夹中具有.htaccess即可将其指向我想要的位置,但从未被看到。

To fix this, I moved the "links" directory to aquizone.net/links. 为了解决这个问题,我将“链接”目录移动到aquizone.net/links。 Placing inside the ./pra/ folder with the .htaccess file. 将.htaccess文件放在./pra/文件夹中。 The subdomain redirects to this folder and then the .htaccess redirects this to the correct wordpress multisite subdirectory. 子域重定向到该文件夹​​,然后.htaccess将其重定向到正确的wordpress多站点子目录。

Of course it would be immensely easier if you could access a multisite by a hard link (for example aquizone.net/blogs/index.php?id=2) and could set the subdoman to redirect directly to that. 当然,如果您可以通过硬链接(例如aquizone.net/blogs/index.php?id=2)访问多站点,并且可以将subdoman设置为直接重定向到该站点,则将非常容易。 But what I have is working. 但是我有工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM