.ht访问两个子目录
我正在尝试让 .htaccess 控制对我网站的访问。我有两个网站:一个是 WordPress 博客,另一个是 wiki 站点,分别位于 mydomain.com/wordpress 和 mydomain.com/wiki。
我希望我的域能够访问 /wordpress,而不在 http-adressebar 中显示它。 (wordpress已经配置对了)。
wiki 站点应该只显示在 /wiki 下。
我已经尝试了很多解决方案(也在 stackoverflow 上),但到目前为止没有任何效果。
RewriteEngine On
RewriteBase /mydomain.com/
# WIKI
RewriteCond %{REQUEST_FILENAME} !-f # Existing File
RewriteCond %{REQUEST_FILENAME} !-d # Existing Directory
RewriteRule ^wiki/(.*)$ wiki/index.php?title=$1 [L,QSA]
# WORDPRESS
# RewriteCond %{REQUEST_FILENAME} !-f # Existing File
# RewriteCond %{REQUEST_FILENAME} !-d # Existing Directory
# RewriteRule ^/*$ /wordpress/index.php [L,QSA]
编辑
www.mydomain.com -> www.mydomain.com/wordpress
www.mydomain.com/wiki/(.*)$ -> www.mydomain.com/wiki/index.php?title=$1
I am trying to make a .htaccess control the access to my websites. I have two websites: one with a wordpress blog and other with a wiki-site placed mydomain.com/wordpress and mydomain.com/wiki.
I want my domain to access /wordpress without showing this in the http-adressebar. (wordpress has been configuration right).
The wiki-site should just be shown under /wiki.
I have tried a lot of solutions (also on stackoverflow), but nothing worked so far.
RewriteEngine On
RewriteBase /mydomain.com/
# WIKI
RewriteCond %{REQUEST_FILENAME} !-f # Existing File
RewriteCond %{REQUEST_FILENAME} !-d # Existing Directory
RewriteRule ^wiki/(.*)$ wiki/index.php?title=$1 [L,QSA]
# WORDPRESS
# RewriteCond %{REQUEST_FILENAME} !-f # Existing File
# RewriteCond %{REQUEST_FILENAME} !-d # Existing Directory
# RewriteRule ^/*$ /wordpress/index.php [L,QSA]
EDIT
www.mydomain.com -> www.mydomain.com/wordpress
www.mydomain.com/wiki/(.*)$ -> www.mydomain.com/wiki/index.php?title=$1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的答案 - 你不能那样做,因为,假设你有一个指向
http://www.yourdoamain.com/index.php
的 url - 你对 apache 的期望是什么点击 - 维基百科,还是博客?Simple answer - you can't do it that way, because, let's say you have an url that points to
http://www.yourdoamain.com/index.php
- what would you expect your apache to hit - the wiki, or the blog?