简体   繁体   English

WordPress安装在单独的目录和.htaccess重定向中

[英]Wordpress Intalled on a separate directory and .htaccess redirection

I've installed my wordpress site on a separate directory and followed all the steps described here and now I can access my site from my main domain. 我已经将Wordpress网站安装在一个单独的目录中,并按照此处描述的所有步骤进行操作,现在我可以从主域访问我的网站了。 So, my Wordpress site is installed under: www.mysite.com/wp-site/ and now I can access my site under www.mysite.com, so all is great, exactly what I wanted. 因此,我的Wordpress网站安装在:www.mysite.com/wp-site/下,现在我可以在www.mysite.com下访问我的网站,所以一切都很好,正是我想要的。 Wordpress is making this happen through an .htaccess file it creates that has the necessary code to make the redirection happen (SEE CODE BELOW). Wordpress正在通过其创建的.htaccess文件来实现此目的,该文件具有进行重定向的必要代码(请参见下面的代码)。

My problem is that I have other directories on my site, such as www.mysite.com/another-directory-unrelated-to-wordpress/ that I cannot access anymore because I believe wordpress and the .htaccess file it created is redirecting everything to the root. 我的问题是我的网站上还有其他目录,例如www.mysite.com/another-directory-unrelated-to-wordpress/,由于我相信wordpress及其创建的.htaccess文件会将所有内容都重定向到该目录,因此我现在无法再访问该目录根。

How can I avoid Wordpress from redirecting all my other subfolders and files? 如何避免Wordpress重定向所有其他子文件夹和文件? Thanks a ton for any ideas or help. 感谢您的任何想法或帮助。

Here is the htaccess file code: 这是htaccess文件代码:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

The way the WordPress .htaccess file works is if an existing file or directory is requested, it does not send the request through WordPress...that's what the !-f and !-d RewriteCond statements do. WordPress的.htaccess文件的工作方式是,如果要求现有的文件或目录,它通过WordPress的发送请求......这是什么!-f!-d RewriteCond报表做的。

So, there is something else going on with your site. 因此,您的网站还有其他问题。 Have you used Firebug or any other debugging tool to see what is happening with the request/response? 您是否使用Firebug或任何其他调试工具来查看请求/响应的情况?

You could always enable mod_rewrite logging to see if that gives you a clue. 您始终可以启用mod_rewrite日志记录,以查看是否有线索。

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteLog "rewrite.log"
RewriteLogLevel 3

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

A RewriteLogLevel of 5 would give you the most information. RewriteLogLevel为5将为您提供最多的信息。 Make sure to comment out or remove the RewriteLog* lines when you have figured out the issue. 解决问题后,请确保注释掉或删除RewriteLog *行。

UPDATE: Check this other SO answer to see if it resolves your issue 更新:检查此其他答案,以查看是否可以解决您的问题

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

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