问题描述
我用一个CMS称为锚。 http://anchorcms.com/docs/getting-started/configuration
当我去domain.com/posts我收到了404,
当我去domain.com/index.php/posts页面正确显示。
这是我的的httpd.conf
文件
<虚拟主机*:443>
#ssl等等等等
的DocumentRoot的/ var / WWW /锚/
服务器名domain.com
ServerAlias domain.com
<目录/ var / WWW /锚定/锚/>
设置AllowOverride所有
选项包括多视图
要求所有批准
< /目录>
< /虚拟主机>
这是我的的.htaccess
文件放置在 /无功/网络/主播/
选项-Indexes
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /
#允许存在直接显示的任何文件或目录
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
#重写所有其他URL的index.php / URL
重写规则^(。*)$的index.php / $ 1 [L]
< / IfModule>
<!IfModule mod_rewrite.c>
的ErrorDocument 404的index.php
< / IfModule>
我有点困惑,如何配置此厘米,理应走在文档根目录的.htcaccess,而我相当肯定我把正确的文件夹。我不认为我必须将URL设置为一个子目录。任何提示?
下面是我的配置文件。 /var/www/anchor/anchor/config/app.php
< PHP
返回数组(
'URL'=> '/',
'指数'=> '',
您的文档根目录为 /无功/网络/锚
,但只允许在<$ C覆盖$ C> /无功/网络/锚定/锚。如果你不是全局性允许覆盖,这将禁用htaccess文件。试着改变你的&LT;目录&GT;
标记以匹配文档根目录:
&LT;目录/ var / WWW /锚GT;
设置AllowOverride所有
选项包括多视图
要求所有批准
&LT; /目录&GT;
I'm using a cms called anchor. http://anchorcms.com/docs/getting-started/configuration
when I go to domain.com/posts I get a 404,
when I go to domain.com/index.php/posts page is displayed correctly.
this is my httpd.conf
file
<VirtualHost *:443>
#ssl blah blah
DocumentRoot /var/www/anchor/
ServerName domain.com
ServerAlias domain.com
<Directory /var/www/anchor/anchor/>
AllowOverride All
Options Includes MultiViews
Require all granted
</Directory>
</VirtualHost>
this is my .htaccess
file placed inside /var/www/anchor/
Options -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
I'm a little confused as how to configure this cms, the .htcaccess supposed to go in the "document root", which I'm fairly sure I put in the correct folder. I don't think I have to set the url to a sub directory. any tips?
here's my config file. /var/www/anchor/anchor/config/app.php
<?php
return array(
'url' => '/',
'index' => '',
Your document root is /var/www/anchor
, but you only allow overrides on /var/www/anchor/anchor
. If you're not globally allowing overrides, that would disable your htaccess file. Try changing your <Directory>
tag to match the document root:
<Directory /var/www/anchor>
AllowOverride All
Options Includes MultiViews
Require all granted
</Directory>
这篇关于如何改写指令在Apache锚厘米的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!