/www/
我在文件夹中有一个站点。在父目录中,我有一个 .htaccess 文件,该文件通过该/www/
目录,就好像它不存在一样。
在该文件夹中,我将 Kirby CMS 作为子模块,它使用自己的 url 重写规则。主页显示为,http://mywebsite.local
但链接显示为http://mywebsite.local/www/page-name
。它们是在 PHP 中动态生成的,而不是硬编码的。
从 url 中手动删除/www/
表明重定向工作正常。所以这一定是一个柯比问题。
kirbycms
是一个 git 子模块,我遵循了本教程http://rimann.org/blog/kirby-git-setup。
结构:
|- .htaccess
|- www
|- |- index.php
|- |- .htaccess
|- |- kirbycms
|- |- |- kirby
|- |- themes
|- |- |- v9
|- |- |- |- site
根.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^www/
RewriteRule ^(.*)$ www/$1 [L]
</IfModule>
柯比.htaccess:
# Kirby .htaccess
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on
# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
# RewriteBase /mysite
#
RewriteBase /
# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301,L]
# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) error [R=301,L]
# block all files in the kirby folder from being accessed directly
RewriteRule ^kirby/(.*) error [R=301,L]
# leave robots.txt alone for search engines
RewriteRule ^robots.txt robots.txt [L]
# make panel links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]
# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>
# Additional recommended values
# Remove comments for those you want to use.
#
# AddDefaultCharset UTF-8
#
# php_flag short_open_tag on
索引.php:
<?php
/*
---------------------------------------
Document root of your site
---------------------------------------
this should be identical with the directory
in which your index.php is located
*/
$root = dirname(__FILE__);
/*
---------------------------------------
Kirby system folder
---------------------------------------
by default this is located inside the root directory
but if you want to share one system folder for
multiple sites, you can easily change that here
and link to a shared kirby folder somewhere on your
server
*/
$rootKirby = $root . '/kirbycms/kirby';
/*
---------------------------------------
Your site folder
---------------------------------------
Your site folder contains all the site specific files
like templates and snippets. It is located in the root
directory by default, but you can move it if you want.
*/
$rootSite = $root . '/theme/v9/site';
/*
---------------------------------------
Your content folder
---------------------------------------
Your content folder is also located in the root
directory by default. You can change this here.
It can also be changed later in your site/config.php
*/
$rootContent = $root . '/content';
// Try to load Kirby
if(!file_exists($rootKirby . '/system.php')) {
die('The Kirby system could not be loaded');
}
require_once($rootKirby . '/system.php');
有谁知道我可以如何设置链接,所以他们没有/www/
?