[英]htaccess redirect to subfolder with exception
我已经搜索了很多没有找到解决方案。
我在/_wp
有一个wordpress博客,在/_wp
中有/other
东西
我要尝试的是将每个请求都重定向到WordPress。 /other
及其子目录中的目录除外。 我还希望对博客的访问权限进行重写。 几个例子可以清楚地说明:
/ --> /_wp/
/ablogpost --> /_wp/ablogpost
/other --> /other
/other/bingou --> /other/bingou
我已经尝试了一些方法,但是对我来说,最合乎逻辑的是:
不要触摸/ _wp /和/ other /的.htaccess
通过添加以下内容来编辑根“ /”的.htaccess:
RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$ RewriteCond %{REQUEST_URI} !^(/other|/other/.*)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/?(.*)$ /_wp/$1
如果您能告诉我什么地方错了,那就太好了!
更改索引后,子文件夹仍然无法使用,当时是我的.htaccess:
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName site.com
# 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
最后,这是一个主机问题,不过感谢您的帮助! 你的答案很好
您应该遵循以下步骤: http : //codex.wordpress.org/Giving_WordPress_Its_Own_Directory
您的wordpress安装已经在其自己的目录中,因此您只需要:
将/_wp/.htaccess
复制到/.htaccess
将/_wp/index.php
复制到/index.php
编辑/index.php
:
require('./_wp/wp-blog-header.php');
编辑/.htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.